Gridview有兩列和自動調(diào)整大小的圖像我正在嘗試用兩列制作gridview。我的意思是每排并排兩張照片,就像這張照片一樣。但是我的照片之間有空格,因為它的大小不一樣。這是我得到的。如您所見,第一張圖片隱藏了顯示聯(lián)系人姓名和電話號碼的圖例。而其他圖片未正確拉伸。這是我的GridView xml文件。如您所見,columnWidth設(shè)置為200dp。我希望它是自動的,所以圖片會自動調(diào)整每個屏幕尺寸的大小。<?xml version="1.0" encoding="utf-8"?><GridView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridViewContacts"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="2"
android:columnWidth="200dp"
android:stretchMode="columnWidth"
android:gravity="center" />這是項目xml文件,它代表每個項目本身。<?xml version="1.0" encoding="utf-8"?><RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/imageViewContactIcon"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" />
<LinearLayout
android:id="@+id/linearlayoutContactName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="#99000000"
android:layout_alignBottom="@+id/imageViewContactIcon">
<TextView
android:id="@+id/textViewContactName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textStyle="bold"
android:textSize="15sp"
android:text="Lorem Ipsum" />
</RelativeLayout>所以我想要的是每行顯示兩個圖像,并且無論屏幕大小如何,圖像都會自動調(diào)整大小。我在布局上做錯了什么?
- 2 回答
- 0 關(guān)注
- 528 瀏覽
添加回答
舉報
0/150
提交
取消