ANDROID STUDIO Card View Layout
1) Run Android Studio
2) Create a new Android Studio Project
2) Create New Project
3) Update Build.Gradle (Module:App) File
4) Edit Layout File
5) Rebuild Project
6) Card View Layout Done.
1) Run Android Studio
2) Create a new Android Studio Project
2) Create New Project
3) Update Build.Gradle (Module:App) File
Edit cardview compile codes in dependencies section:
compile 'com.android.support:cardview-v7:21.0.+' |
4) Edit Layout File
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> <TextView android:text="@string/hello_world" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/cv" > <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/person_photo" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginRight="16dp" android:background="@mipmap/ic_launcher" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/person_name" android:layout_toRightOf="@+id/person_photo" android:layout_alignParentTop="true" android:textSize="30sp" android:autoText="false" android:text="test" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/person_age" android:layout_toRightOf="@+id/person_photo" android:layout_below="@+id/person_name" android:text="123" /> </RelativeLayout> </android.support.v7.widget.CardView> </RelativeLayout> |
5) Rebuild Project
6) Card View Layout Done.
-
0 Comments