My xml is as follows
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow android:layout_weight="1" android:gravity="center">
<ImageView android:layout_height="200dp"
android:layout_width = "wrap_content"
android:src="@drawable/saltnpepper"
android:scaleType="centerInside" />
</TableRow>
<TableRow android:layout_weight="3" >
<ListView android:id="@+id/list1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
>
</ListView>
</TableRow>
<TableRow android:layout_weight="1" android:gravity="center">
<ImageView android:layout_height="100dp"
android:layout_width = "wrap_content"
android:src="@drawable/halal"
android:scaleType="centerInside"/>
</TableRow>
</TableLayout>
My screen is currently like this:
I want the Saltnpepper
image to expand across the width of screen, I have tried setting ImageView
's layout_height
to 0dp
but the image disappears then. also I have tried its layout_width
as match_parent
, but it didn't work
Also, I want to add some margin to the ListView
but the whole table_layout
moves if I add marginRight
or marginLeft
to the ListView
element.