刀科の技術学習ブログ

アプリサイドから、web系フロント・バックとAWSによるインフラ領域へ学習を進めていきます。

【Android】CardViewのカスタマイズ

メモ

<android.support.v7.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="wrap_content"
    android:layout_height="match_parent"
    android:layout_margin="4dp"     リスト用途の時の要素間の間隔として
    android:foreground="?android:attr/selectableItemBackground"
    app:cardBackgroundColor="#00F0"    背景色はこれ
    app:cardUseCompatPadding="true"
    app:cardCornerRadius="10dp"    角丸の具合
>
    <TextView
        android:id="@+id/text_data"
        android:textColor="#000"
        android:padding="6dp"  CardViewに書いても効果ないので子要素から。layout_marginでもいいし用途次第
        android:layout_width="wrap_content"
        android:layout_height="match_parent" />
</android.support.v7.widget.CardView>