Skip to content

Instantly share code, notes, and snippets.

@bherbst
Created March 24, 2014 13:52
Show Gist options
  • Select an option

  • Save bherbst/9740484 to your computer and use it in GitHub Desktop.

Select an option

Save bherbst/9740484 to your computer and use it in GitHub Desktop.
ProgressBar layout
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<ProgressBar
android:id="@+id/redBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:indeterminate="false"
android:progressDrawable="@drawable/progress_red" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical"
android:paddingLeft="8dp" >
<TextView
android:id="@+id/redName"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="bottom"
android:includeFontPadding="false"
android:textStyle="bold"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/redScore"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="top"
android:includeFontPadding="false"
android:textColor="@android:color/white" />
</LinearLayout>
<RatingBar
android:id="@+id/redRating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/MyAppRatingBar" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<ProgressBar
android:id="@+id/blueBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:indeterminate="false"
android:progressDrawable="@drawable/progress_blue" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical"
android:paddingLeft="8dp" >
<TextView
android:id="@+id/blueName"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="bottom"
android:includeFontPadding="false"
android:textStyle="bold"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/blueScore"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="top"
android:includeFontPadding="false"
android:textColor="@android:color/white" />
</LinearLayout>
<RatingBar
android:id="@+id/BlueRating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/MyAppRatingBar" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<ProgressBar
android:id="@+id/greenBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:indeterminate="false"
android:progressDrawable="@drawable/progress_green" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:orientation="vertical"
android:paddingLeft="8dp" >
<TextView
android:id="@+id/greenName"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="bottom"
android:includeFontPadding="false"
android:textStyle="bold"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/greenScore"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="top"
android:includeFontPadding="false"
android:textColor="@android:color/white" />
</LinearLayout>
<RatingBar
android:id="@+id/greenRating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/MyAppRatingBar" />
</RelativeLayout>
</merge>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment