如何从用户那里获取图像并将其显示在像Google Keep这样的CardView中?

时间:2016-01-15 09:22:01

标签: android android-studio android-cardview

目前我正在使用卡片视图:

<?xml version="1.0" encoding="utf-8"?>

    <android.support.v7.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/cv"
    android:foreground="?android:attr/selectableItemBackground">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="1dp"
        >

        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="false"
            android:id="@+id/person_photo"
            android:src="@drawable/nature"
            android:adjustViewBounds="true"
            />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/person_name"
            android:layout_below="@+id/person_photo"
            android:textSize="30sp"
            android:text="THE TITLE"
            />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/person_age"
            android:layout_below="@+id/person_name"
            android:text="Then the text"
            />

    </RelativeLayout>
    </android.support.v7.widget.CardView>

ArrayList 中提取数据,从SQLite数据库中提取数据,我想知道如何让用户为任何特定的 cardview选择他/她自己的图像

1 个答案:

答案 0 :(得分:0)

在适配器类中为cardview设置onclicklistener