In order to display a percentage text inside Android's progressbar,
you will need to set up a <RelativeLayout>.  Give the RelativeLayout
parameters followed below:

android:layout_width="200dip"
android:layout_height="30dip"
android:padding="0dip"

Then close your RelativeLayout.  Inside your layout, insert your
<ProgressBar> with following parameters:

android:id="@+id/youridgoeshere"
android:layout_width="200dip"
android:layout_height="30dip"
android:layout_centerInParent="true"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminateOnly="false"
android:max="100"

That's all for the progressbar, now on to the percentage text.  Create
a <TextView> inside your layout and give it the following parameters:

android:"@+id/youridgoeshere"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textColor="#000000"
android:textStyle="bold"

Close your TextView and there you have it!!! Your text should be
centered horizontally and vertically inside your progressbar.  The key
is to set up a relative layout while keeping it the same width as the
progress bar. Then using the parameter "centerInParent" keeps both the
progress bar and textview in the center of the relative parent.  Hope
this helps out. Enjoy!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to