我的XML如下的Android ImageView的擴大屏幕
<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>
我的屏幕是目前這樣的:
我想Saltnpepper
圖像跨越擴大屏幕寬度,我試圖設置ImageView
的layout_height
到0dp
,但圖像消失。我也試過它作爲match_parent
layout_width
,但沒有奏效
另外,我想添加一些緣至ListView
但整個table_layout
移動如果我添加marginRight
或marginLeft
到ListView
元素。
的android:layout_width = 「match_parent」 運作的?和列表視圖,嘗試用paddingLeft和paddingRight – X3Btel
感謝Adeel它確實有效!只有現在形象被拉伸可能是我應該把它放在背景 – Samra