I'm trying to get an Android ProgressBar to horizontally fill the remaining space in a TableLayout. Its parent row seems to occupy the full width, but when I set the layout parameters to match_parent
nothing happens. All I get is the same default-sized (48dip wide) ProgressBar.
I found if I just put a ProgressBar inside a LinearLayout and set it to match_parent
, I got exactly what I wanted. But somehow it doesn't work properly in a TableLayout?
Here's the relevant layout code:
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="X" />
<ProgressBar
android:id="@+id/gyroConfX"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:indeterminate="false" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Y" />
<ProgressBar
android:id="@+id/gyroConfY"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminate="false" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Z" />
<ProgressBar
android:id="@+id/gyroConfZ"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminate="false" />
</TableRow>
</TableLayout>
And here's what it looks like: