【发布时间】:2023-01-18 15:15:34
【问题描述】:
我在 CardView 中显示 cardCornerRadius 时遇到一点问题。在模拟器上一切正常,但一旦我在真实设备上测试应用程序,我就再也看不到 CardView 周围的圆角半径。可能是什么原因 ? API 级模拟器 28 (PIE)
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="20dp"
app:cardCornerRadius="20dp"
>
...
</LinearLayout>
模拟器视图:
【问题讨论】:
-
手机图片截图
-
将卡片视图置于线性布局之外
-
见this。您的问题的解决方案就在这里。
-
但我需要 LinearLayout...
-
你能解释一下你的 XML 代码吗,你有 wrap_content 有一个高度,为什么它不添加和显示角半径
标签: android android-studio android-design-library android-developer-api