Skip to content

Commit 91e39f9

Browse files
committed
style #11: add card item design
1 parent 3870543 commit 91e39f9

File tree

5 files changed

+56
-11
lines changed

5 files changed

+56
-11
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector android:height="24dp" android:tint="#FAFAFA"
2+
android:viewportHeight="24" android:viewportWidth="24"
3+
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
4+
<path android:fillColor="@android:color/white" android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"/>
5+
</vector>

RecycleViewListApp/app/src/main/res/layout/activity_main.xml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
android:layout_height="match_parent"
77
tools:context=".MainActivity">
88

9-
<TextView
10-
android:layout_width="wrap_content"
11-
android:layout_height="wrap_content"
12-
android:text="Hello World!"
13-
app:layout_constraintBottom_toBottomOf="parent"
14-
app:layout_constraintLeft_toLeftOf="parent"
15-
app:layout_constraintRight_toRightOf="parent"
16-
app:layout_constraintTop_toTopOf="parent" />
179

10+
<androidx.recyclerview.widget.RecyclerView
11+
android:id="@+id/recyclerView"
12+
android:layout_width="match_parent"
13+
android:layout_height="match_parent"
14+
tools:layout_editor_absoluteX="201dp"
15+
tools:layout_editor_absoluteY="290dp" />
1816
</androidx.constraintlayout.widget.ConstraintLayout>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:id="@+id/card_view"
6+
android:layout_width="match_parent"
7+
android:layout_height="match_parent"
8+
android:layout_margin="5dp"
9+
app:cardBackgroundColor="#FF7043"
10+
app:cardCornerRadius="5dp"
11+
app:contentPadding="5dp">
12+
13+
<androidx.constraintlayout.widget.ConstraintLayout
14+
android:layout_width="match_parent"
15+
android:layout_height="wrap_content"
16+
android:padding="10dp">
17+
18+
<ImageView
19+
android:id="@+id/itemImage"
20+
android:layout_width="30dp"
21+
android:layout_height="30dp"
22+
android:contentDescription="@string/location_icon"
23+
android:src="@drawable/ic_baseline_location_on_24"
24+
app:layout_constraintBottom_toBottomOf="parent"
25+
app:layout_constraintStart_toStartOf="parent"
26+
app:layout_constraintTop_toTopOf="parent" />
27+
28+
<TextView
29+
android:id="@+id/itemTitle"
30+
android:layout_width="269dp"
31+
android:layout_height="31dp"
32+
android:textColor="#fff"
33+
android:textSize="20sp"
34+
app:layout_constraintBottom_toBottomOf="parent"
35+
app:layout_constraintEnd_toEndOf="parent"
36+
app:layout_constraintStart_toEndOf="@+id/itemImage"
37+
app:layout_constraintTop_toTopOf="parent" />
38+
39+
</androidx.constraintlayout.widget.ConstraintLayout>
40+
41+
</com.google.android.material.card.MaterialCardView>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<color name="purple_200">#FFBB86FC</color>
4-
<color name="purple_500">#FF6200EE</color>
5-
<color name="purple_700">#FF3700B3</color>
3+
<color name="purple_200">#000000</color>
4+
<color name="purple_500">#000000</color>
5+
<color name="purple_700">#000000</color>
66
<color name="teal_200">#FF03DAC5</color>
77
<color name="teal_700">#FF018786</color>
88
<color name="black">#FF000000</color>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<resources>
22
<string name="app_name">RecycleView List App</string>
3+
<string name="location_icon">location icon</string>
34
</resources>

0 commit comments

Comments
 (0)