Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 创建CardView,将其拐角半径应用于其内部的ImageView_Android_Material Design_Cardview - Fatal编程技术网

Android 创建CardView,将其拐角半径应用于其内部的ImageView

Android 创建CardView,将其拐角半径应用于其内部的ImageView,android,material-design,cardview,Android,Material Design,Cardview,我尝试在Android应用程序中创建带有圆角半径的ImageView的CardView 我发现,当我们尝试将cardCornerRadius设置为大于0(如12dp)时,它没有将radius应用于CardView内部的ImageView 如何将radius应用于CardView内部的ImageView? 提前谢谢你的帮助 使用应用程序:cardUseCompatPadding=“true” <android.support.v7.widget.CardView xmlns:andr

我尝试在Android应用程序中创建带有圆角半径的ImageView的CardView

我发现,当我们尝试将cardCornerRadius设置为大于0(如12dp)时,它没有将radius应用于CardView内部的ImageView

如何将radius应用于CardView内部的ImageView? 提前谢谢你的帮助



使用
应用程序:cardUseCompatPadding=“true”

<android.support.v7.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:id="@+id/card_view"
    android:layout_width="match_parent"
    android:layout_height="@dimen/card_height"
    android:layout_gravity="center"
    android:layout_marginBottom="@dimen/md_keylines"
    android:layout_marginLeft="@dimen/md_keylines"
    android:layout_marginRight="@dimen/md_keylines"
    android:foreground="?attr/selectableItemBackground"
    app:cardCornerRadius="12dp"
    app:cardUseCompatPadding="true">


将单个视图(如图像视图或文本视图)放入cardview中,并为其提供app:cardCornerRadius

谢谢。你的意思是我们需要添加子CardView并将ImageView放入其中,对吗?是的,我原以为会有效果,但实际上没有@SINAMN75是否仅在API<21时发生?如果是这样,那么它的目的是-CardView不会剪辑旧设备上的内容。
<android.support.v7.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:id="@+id/card_view"
    android:layout_width="match_parent"
    android:layout_height="@dimen/card_height"
    android:layout_gravity="center"
    android:layout_marginBottom="@dimen/md_keylines"
    android:layout_marginLeft="@dimen/md_keylines"
    android:layout_marginRight="@dimen/md_keylines"
    android:foreground="?attr/selectableItemBackground"
    app:cardCornerRadius="12dp"
    app:cardUseCompatPadding="true">