卡列表我一直在尋找一些ListView
,造型技巧,我發現這一個Post-How to make card List,我希望ListItems
成爲像這樣:如何使機器人
list_item_background.xml
是:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle"
android:dither="true">
<corners android:radius="2dp"/>
<solid android:color="#ccc" />
</shape>
</item>
<item android:bottom="2dp">
<shape android:shape="rectangle"
android:dither="true">
<corners android:radius="2dp" />
<solid android:color="@android:color/white" />
<padding android:bottom="8dp"
android:left="8dp"
android:right="8dp"
android:top="8dp" />
</shape>
</item>
我已經實現了,在我的RowOfListView.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="wrap_content"
android:layout_margin="@dimen/ten"
android:background="@drawable/list_item_background" >
<ImageView
android:id="@+id/imageView_in_row"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/row_member_name"
android:layout_marginBottom="@dimen/ten"
android:layout_marginLeft="@dimen/five"
android:background="@drawable/rectangle"
android:contentDescription="@string/image"
android:src="@drawable/member" />
<TextView
android:id="@+id/row_member_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/ten"
android:layout_marginRight="@dimen/ten"
android:layout_marginTop="@dimen/ten"
android:layout_toRightOf="@+id/imageView_in_row"
android:ellipsize="end"
android:text="Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
.
.
.
</RelativeLayout>
但我發現了這樣一條:
無法獲取margin
如在現有的畫面,我應該在哪裏設置margin
Items
之間ListView
。
你可以發佈我們的適配器代碼嗎? –