Xamarin.Android Card View Высота не отображается - PullRequest
0 голосов
/ 23 мая 2018

У меня есть CardView внутри RecyclerView, но высота карты не показывает тень.

Я пытался использовать clipToPadding, как предлагалось в других ответах, а также играть с отступами в родительской ViewGroup, но безрезультатно.Ниже я разместил два соответствующих файла макета.

Буду признателен за любые предложения.

Макет, содержащий RecyclerView

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
 >
  <ProgressBar
  android:layout_width="wrap_content"
  android:layout_height="80dp"
  android:id="@+id/ProgressBar"
  android:indeterminate="true"
  android:layout_gravity="center"
  android:layout_margin="30dp"
  android:layout_centerVertical="true"
  android:layout_centerInParent="true"
  android:background="@drawable/ProgressBarStyle"
  android:visibility="visible" />
<android.support.v7.widget.RecyclerView
  android:id="@+id/RecyclerView"
  android:scrollbars="vertical"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
   />
<TextView
  android:id="@+id/textGuest"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:gravity="center"
  android:visibility="gone"
  android:text="Please sign in to start saving your favourite recipes"
  android:layout_marginTop="30dp"
  android:padding="10dp" />
</LinearLayout>

Макет просмотра карты

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
card_view:cardElevation="0.7dp"
card_view:cardUseCompatPadding="true"
card_view:cardCornerRadius="5dp"
card_view:cardBackgroundColor="@color/PaleGreen">
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="5dp">
    <ImageView
        android:id="@+id/photoImageView"
        android:layout_width="fill_parent"
        android:layout_height="125dp" />
    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="@android:color/darker_gray"
        android:layout_margin="2dp" />
    <TextView
        android:id="@+id/recipeNameTextView"
        android:layout_below="@id/photoImageView"
        android:gravity="center"
        android:textStyle="bold"
        android:layout_marginTop="5dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v7.widget.CardView>

1 Ответ

0 голосов
/ 25 мая 2018

высота карты не показывает тень.

Я проверил ваш код.Тень показывает.Вы устанавливаете только 0,7dp, поэтому похоже, что он не отображается.Пожалуйста, попробуйте использовать большее значение.

Например, 0.7dp выглядит так: 0.7dp

5dp:enter image description here

и 10dp:enter image description here

...