【发布时间】:2020-01-28 21:10:27
【问题描述】:
我正在开发一个 android 应用程序,我正在使用 recyclerview。我已经设法用数据显示行并将设计应用于它们,除了我无法为行获得圆角。下面是我的xml 文件。
名称为rounded_corners_cards.xml 的文件用于圆角:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white"/>
<stroke android:width="3dp"
android:color="@color/grayLight"/>
<padding android:left="1dp"
android:top="1dp"
android:right="1dp"
android:bottom="1dp"/>
<corners android:bottomRightRadius="7dp"
android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp"/>
</shape>
行文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
style="@style/StandardListRow"
android:layout_height="60dp"
android:orientation="vertical"
android:background="@drawable/rounded_corners_cards">
<ImageView
android:id="@+id/offer_picture"
style="@style/StyleRowIcon"
android:contentDescription="@string/card_offer_image"
android:scaleType="centerInside" />
</RelativeLayout>
我尝试更改rounded_corners_cards.xml 文件但没有运气。
感谢您的建议。
【问题讨论】:
-
能否添加一张你得到的结果的图片?
-
我更新了问题并添加了截图。
-
添加你的样式文件。我正在测试,我怀疑宽度和高度。
标签: android android-recyclerview rounded-corners