Posted By

BenClayton on 02/27/11


Tagged

xml layout android


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

rogerodell


Android: Layout with a vertically-centered widget


 / Published in: XML
 

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="match_parent" android:layout_height="match_parent"
  4. android:orientation="vertical">
  5.  
  6. <ProgressBar
  7. android:layout_centerInParent="true"
  8. style="@android:style/Widget.ProgressBar.Horizontal"
  9. android:id="@+id/progressBar"
  10. android:layout_width="fill_parent"
  11. android:layout_height="60sp"
  12. android:layout_margin="10sp"
  13. ></ProgressBar>
  14. <TextView android:layout_below="@id/progressBar"
  15. android:text="XX% complete" android:gravity="center" android:id="@+id/status"
  16. android:layout_width="fill_parent" android:layout_height="wrap_content"></TextView>
  17.  
  18. </RelativeLayout>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: BenClayton on February 27, 2011

Also has the 'magic style' to enable a horizontal progress bar

You need to login to post a comment.