'Card View'에 해당되는 글 1건

  1. 2020.09.21 Card View

activity_main.xml

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="16dp"
    app:cardCornerRadius="20dp"
    app:cardElevation="8dp"
    android:foreground="?android:attr/selectableItemBackground"
    android:focusable="true"
    android:clickable="true"
    tools:context=".MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="30sp"
            android:layout_gravity="center"
            android:textColor="#000"
            android:text="khon 카드뷰"/>

    </LinearLayout>

</androidx.cardview.widget.CardView>

------------------

 

 

------------------

build.gradle (:app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.1"

    defaultConfig {
        applicationId "com.example.cardview"
        minSdkVersion 28
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
    implementation 'androidx.cardview:cardview:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}

'안드로이드 앱 만들기' 카테고리의 다른 글

Linear Layout (2)  (0) 2020.10.06
Fragment끼리 데이터 전송  (0) 2020.09.22
Frame Layout (뷰 끼리 겹치기)  (0) 2020.09.20
Table Layout  (0) 2020.09.15
Check Box (옵션 선택 버튼)  (0) 2020.09.12
Posted by khon98
,