I'm trying to use a progress bar (the normal one, not the horizontal one) as a compass of sorts, but for some reason the bar just keeps spinning without control. I've set the indeterminate to false, both in the xml and in the attached Java code, but it seems to do nothing.
This is the xml code for the View:
<ProgressBar
android:id="@+id/brujula"
style="?android:attr/progressBarStyle"
android:layout_width="229dp"
android:layout_height="507dp"
android:layout_marginStart="91dp"
android:layout_marginTop="90dp"
android:layout_marginEnd="91dp"
android:layout_marginBottom="135dp"
android:visibility="invisible"
android:indeterminate="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
The code I'm using to set it to false in Java too is
ProgressBar brujula = (ProgressBar) FindViewById(R.id.brujula);
brujula.setIndeterminate(false);
I have no idea whatsoever of why it keeps doing that, so any help at all will be appreciated
If you want to use the Progress bar again it's better to just hide it:
brujula.setVisibility(View.GONE);
Or you can remove it completely:
((ViewGroup) brujula.getParent()).removeView(brujula);
hi try this if you want to show progressbar do like this.
ProgressBar brujula = (ProgressBar) FindViewById(R.id.brujula);
brujula.setVisibility(View.VISIBLE);
and where you want to stop loading and want to hide progressbar use
brujula.setVisibility(View.GONE);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.