android按钮进度动画,android – 在按钮后面放置一个进度条
要做到這一點(diǎn),我必須首先在main.xml中定義按鈕,然后是進(jìn)度條,如下所示:
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" />
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" />
然后,一旦我初始化了所有GUI組件,我就不得不將按鈕帶回進(jìn)度條前面:
searchButton.bringToFront();
最終的結(jié)果
啟用時(shí)按鈕:
使用進(jìn)度條禁用按鈕:
總結(jié)
以上是生活随笔為你收集整理的android按钮进度动画,android – 在按钮后面放置一个进度条的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 自动打包+ios+android,使用
- 下一篇: android主题编辑器,使用 Them