Es gibt viele Fragen über Cardview Elevation hier und ich versuchte alle Lösung, um das Problem zu lösen, aber es funktioniert immer noch nicht. Ich habe card_view: cardUseCompatPadding = "true" in cardview hinzugefügt und ich habe auch versucht, die Hardwarebeschleunigung im Android-Manifest auf true zu setzen. Ich lese auch, dass wenn ich Padding in Cardview verwende, könnte es die Schatten für die Kartenansicht ausschneiden. Kann mir jemand sagen, was ich falsch mache? Ich kann die Schatten im Android-Studio sehen, aber nicht auf dem Emulator oder realen Gerät.Karte Ansicht nicht angezeigt
<?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"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="20dp"
card_view:cardBackgroundColor="@android:color/white"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="6dp"
android:id="@+id/cardView"
card_view:cardUseCompatPadding="true"
>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/horizontal_spacing">
<ImageView
android:id="@+id/imageView"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="end"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/aboutpallogo"/>
<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:textSize="14dp"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:textColor="#171652"
android:textDirection="rtl"
app:layout_constraintBottom_toBottomOf="@+id/imageView"
app:layout_constraintEnd_toStartOf="@+id/imageView"
app:layout_constraintStart_toStartOf="parent"
tools:text="Header"/>
<TextView
android:id="@+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="TextView"
android:textDirection="rtl"
android:textColor="#4cbea9"
app:layout_constraintEnd_toEndOf="@+id/textView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"/>
<View
android:id="@+id/divider"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:background="@drawable/divider"
app:layout_constraintEnd_toEndOf="@+id/textView2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2"/>
<com.mediamer.apps.pal_library.helpers.ExpandableTextView
android:id="@+id/expandableTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="24dp"
app:expanded="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/textView2"
app:layout_constraintEnd_toStartOf="@+id/imageView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider"
/>
</android.support.constraint.ConstraintLayout>
</android.support.v7.widget.CardView>
Ich habe versucht, aber nicht funktioniert. – abdo
Ich verwende Cardview in Gridview. Ich erstellte auch eine andere Aktivität und versuchte, die Cardview zu testen, um zu sehen, ob die Gridview der Grund ist, warum der Schatten nicht angezeigt wird, aber es hat nicht so gut funktioniert – abdo