Android: Layout with a vertically-centered widget


/ Published in: XML
Save to your folder(s)



Copy this code and paste it in your HTML
  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

You need to login to post a comment.