Skip to content

Commit 16a2c03

Browse files
author
fengjian
committed
test divider -- part 1
1 parent 46d1b57 commit 16a2c03

File tree

3 files changed

+87
-9
lines changed

3 files changed

+87
-9
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<item android:state_checked="true" android:state_focused="true" android:drawable="@color/list_item_pressed">
5+
</item>
6+
7+
<item android:state_focused="true" android:drawable="@color/list_item_pressed">
8+
</item>
9+
10+
<item android:state_selected="true" android:drawable="@color/list_item_pressed">
11+
</item>
12+
13+
<item android:state_checked="true" android:drawable="@color/list_item_pressed">
14+
</item>
15+
16+
<item android:state_pressed="true" android:drawable="@color/list_item_pressed">
17+
</item>
18+
19+
<item android:drawable="@color/list_item_normal">
20+
</item>
21+
22+
</selector>
Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,63 @@
11
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
3-
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
4-
android:paddingRight="@dimen/activity_horizontal_margin"
5-
android:paddingTop="@dimen/activity_vertical_margin"
6-
android:paddingBottom="@dimen/activity_vertical_margin"
7-
tools:context="com.jayfeng.lesscode.app.activity.ResourceActivity">
8-
9-
<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
10-
android:layout_height="wrap_content" />
2+
android:layout_width="match_parent"
3+
android:layout_height="match_parent">
4+
5+
<!--这个group_container的background一定要设置,
6+
而且要和list_item_bg的list_item_normal一致,
7+
否则效果会不正确。 -->
8+
<LinearLayout
9+
android:id="@+id/group_container"
10+
android:layout_width="wrap_content"
11+
android:layout_height="wrap_content"
12+
android:layout_alignParentTop="true"
13+
android:layout_marginTop="48dp"
14+
android:background="#fff"
15+
android:orientation="vertical">
16+
17+
<RelativeLayout
18+
android:id="@+id/account_container"
19+
android:layout_width="match_parent"
20+
android:layout_height="wrap_content"
21+
android:background="@drawable/list_item_bg"
22+
android:clickable="true">
23+
24+
<TextView
25+
android:id="@+id/account_title"
26+
android:layout_width="wrap_content"
27+
android:layout_height="wrap_content"
28+
android:layout_alignParentLeft="true"
29+
android:layout_centerVertical="true"
30+
android:layout_margin="16dp"
31+
android:text="First Item"
32+
android:textColor="#f00"
33+
android:textSize="16sp" />
34+
</RelativeLayout>
35+
36+
<View
37+
android:layout_width="match_parent"
38+
android:layout_height="1px"
39+
android:layout_marginLeft="16dp"
40+
android:background="#f00" />
41+
42+
<RelativeLayout
43+
android:id="@+id/phone_container"
44+
android:layout_width="match_parent"
45+
android:layout_height="wrap_content"
46+
android:background="@drawable/list_item_bg"
47+
android:clickable="true">
48+
49+
<TextView
50+
android:id="@+id/phone_title"
51+
android:layout_width="wrap_content"
52+
android:layout_height="wrap_content"
53+
android:layout_alignParentLeft="true"
54+
android:layout_centerVertical="true"
55+
android:layout_margin="16dp"
56+
android:text="Second Item"
57+
android:textColor="#f00"
58+
android:textSize="16sp" />
59+
60+
</RelativeLayout>
61+
</LinearLayout>
1162

1263
</RelativeLayout>

app/src/main/res/values/colors.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="list_item_normal">#fff</color>
4+
<color name="list_item_pressed">#eee</color>
5+
</resources>

0 commit comments

Comments
 (0)