android - Positioning a progress bar behind a button -


i have button defined in relativelayout follows:

<button         android:id="@+id/search_button"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_below="@id/current_location"         android:layout_marginleft="5dp"         android:layout_marginright="5dp"         android:paddingbottom="30dp"         android:paddingtop="30dp"         android:text="@string/search" /> 

i add progressbar behind button occupies exact same space button, when button disabled (translucent), can see progress bar behind it. how this?

to had define button in main.xml first, followed progress bar follows:

<button     android:id="@+id/search_button"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_below="@id/current_location"     android:layout_marginleft="5dp"     android:layout_marginright="5dp"     android:paddingbottom="30dp"     android:paddingtop="30dp"     android:text="@string/search" />  <progressbar     android:id="@+id/cooldown_bar"     style="@android:style/widget.progressbar.horizontal"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_alignbottom="@id/search_button"     android:layout_below="@id/current_location"     android:layout_marginbottom="6dp"     android:layout_marginleft="9dp"     android:layout_marginright="9dp"     android:layout_margintop="1dp"     android:indeterminate="false"     android:progressdrawable="@drawable/progress_bar" /> 

then, once had initialized gui components, had bring button in front of progress bar with:

searchbutton.bringtofront(); 

the end result

button when enabled:

button when enabled

button when disabled progress bar:

button when disabled progress bar


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

node.js - StackOverflow API not returning JSON -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -