Hi,
I have a TableLayout in my Android application.
In the TableLayout, I have a TableRow which has an oversized background image.
I would like the background image to be auto-sized to cater to the content within the TableRow. But no matter how I try, it always display the original size. Please refer to link for screen capture.
As seen in the screen capture, the TableRow expanded to fit the original size of the background image but not the TextViews within.
Here's the code,
<TableLayout android:id="@+id/RatingDetailsTable"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/RestPic"
android:layout_marginTop="10dp"
android:stretchColumns="*"
>
<TableRow android:id="@+id/RatingDetailsTableHeader"
android:background="@drawable/grey_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/RatingDetailsOverall"
android:text="Overall 8.2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="13sp"
android:textColor="#ffffffff"
/>
<TextView
android:id="@+id/RatingDetailsReviewNo"
android:text="Based on 25 review(s)"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="13sp"
android:textColor="#ffffffff"
/>
</TableRow>
</TableLayout>
I would want the TableRow to be of the height of the 2 TextViews and thus, have the background image to have the same height and width accordingly.
Please advise.