【发布时间】:2014-09-22 15:51:15
【问题描述】:
如何在不确定的 ProgressBar(旋转轮)的中心显示文本?
我想在中间显示秒。使用安卓 API-19。 docs 表示要显示进度,必须使用水平条。 但是,如果我可以在中心显示文本,那么这对我有用。
再说一遍,如何设置文本以显示在旋转轮进度条中?
(我宁愿在跑之前尝试使用现有的 API 来构建自定义进度条)
<RelativeLayout 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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.mycom.countdowntimer.CountdownMainActivity$PlaceholderFragment" >
<ProgressBar
android:id="@+id/progressBar1"
android:indeterminate="true"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="87dp" />
</RelativeLayout>
【问题讨论】:
-
在 XML 中添加文本视图
-
@pedro 在哪里?见上面的xml
-
进度条父级是什么布局?
-
@pedro 我的布局很灵活 - 可以将其更改为任何可行的内容。
标签: android