Progressbar android里面有文字

use*_*732 4 android android-progressbar

我有一个循环ProgressBar,我想要在这个圆形栏内,以百分比写出进展(如60%,或70%..)
我怎么能在圆形内做到这一点ProgressBar

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

        <ProgressBar
            android:id="@+id/progressBars"
            android:layout_width="200dp"
            android:layout_height="200dp"
            android:layout_centerInParent="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="20dp"
            android:indeterminate="false"
            android:indeterminateDrawable="@drawable/progress_bar"
            android:max="100" />
    </RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

fll*_*llo 8

你应该试试这个:

<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" >

    <ProgressBar
        android:id="@+id/myProgress"
        android:layout_width="match_parent" android:layout_height="match_parent" />

    <TextView
        android:id="@+id/myTextProgress"
        android:layout_alignLeft="@id/myProgress" android:layout_alignTop="@id/myProgress"
        android:layout_alignRight="@id/myProgress" android:layout_alignBottom="@id/myProgress"
        android:background="@android:color/transparent" >

</RelativeLayout>  
Run Code Online (Sandbox Code Playgroud)

你也可以将centerInParent设置为true,看看这个.
看看本教程这一个更多的信息,以显示您的百分比.
希望这会有所帮助.