卡列表我一直在寻找一些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
。
你可以发布我们的适配器代码吗? –