앱 build.gradle 추가사항
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
ConstraintLayout 을 이용하여 Layout 구성
<?xml version="1.0" encoding="utf-8"?> <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/cardview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="1dp" app:cardCornerRadius="1dp">
<androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content">
<ImageView android:id="@+id/listitem_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toStartOf="@+id/listitem_title" app:srcCompat="@drawable/photo_base" />
<TextView android:id="@+id/listitem_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="성명" android:textSize="20dp" android:layout_marginLeft="10dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/listitem_subtitles" app:layout_constraintStart_toEndOf="@+id/listitem_image" app:layout_constraintTop_toTopOf="parent" />
<LinearLayout android:id="@+id/listitem_subtitles" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:orientation="vertical" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@+id/listitem_checkbox" app:layout_constraintStart_toEndOf="@+id/listitem_title" app:layout_constraintTop_toTopOf="parent">
<TextView android:id="@+id/listcell_subtext1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="서브타이틀1" android:textColor="@color/colorBlack" android:textSize="14dp" android:textStyle="normal" />
<TextView android:id="@+id/listcell_subtext2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="서브타이틀2" android:textColor="@color/colorBlack" android:textSize="14dp" android:textStyle="normal" />
</LinearLayout>
<CheckBox android:id="@+id/listitem_checkbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="false" android:visibility="gone" android:layout_marginLeft="20dp" app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/listitem_subtitles" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.cardview.widget.CardView>
|
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity">
<androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" tools:listitem="@layout/item_listview" />
</androidx.constraintlayout.widget.ConstraintLayout> |