在FrameLayout中添加一个ProgressBar居中

<ProgressBar
        android:layout_gravity="center"
        android:id="@+id/progressBar1"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

添加一个TextView居中

<TextView
        android:layout_gravity="center"
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="0%" />

该程序实现了一个跑动的进度条,使用了多线程,参考自:http://www.cnblogs.com/tyjsjl/p/4014285.html

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="使用帧布局(FrameLayout)实现一个ProgressBar的动态效果" />

    <ProgressBar
        android:layout_gravity="center"
        android:id="@+id/progressBar1"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <TextView
        android:layout_gravity="center"
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="0%" />

</FrameLayout>
activity_main.xml

相关文章:

  • 2021-12-12
  • 2022-01-04
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
相关资源
相似解决方案