Мой xml выглядит следующим образом:
<?xml version="1.0" encoding="utf-8"?>
<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/recyclerMainCardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
app:cardElevation="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/imgRecyclerMain"
android:layout_width="match_parent"
android:layout_height="100dp"
android:fitsSystemWindows="true"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical"
android:weightSum="5">
<TextView
android:id="@+id/txtRecyclerMainTheme"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_weight="2"
android:orientation="horizontal">
<TextView
android:id="@+id/txtRecyclerMainNumberCommunity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:textSize="14sp" />
<TextView
android:id="@+id/txtRecyclerMainNumberArticles"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
Это мой recycler_main_themes.xml, который внутри окна рециркулятора отображает темы.Поведение изображения, которое я ищу, состоит в том, чтобы иметь карту с левой и правой границами с радиусом 8dp, поэтому я поместил в MainActivity это:
cardView.setBackgroundResource(R.drawable.card_view_border);
И это card_view_border.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<corners android:topLeftRadius="10dp" android:topRightRadius="10dp" />
</shape>
Но когда приложение запускается до отображения изображения, у cardView есть обе верхние границы с радиусом, после чего после загрузки изображения imageView перекрывает cardView, и карта выглядит прямоугольной.Изображение того, как оно есть:
![enter image description here](https://i.stack.imgur.com/5e7NY.png)
Что мне не хватает, чтобы отобразить его правильно?
Редактировать: просто дополнить, я 'мы пробовали много вещей, таких как изменение масштаба типа ImageView на fitXY
, установка setPreventCornerOverlap(false)
на CardView, изменение cardElevation на CardView и установка повышения на ImageView, но ни один из них не удался.