Как добавить эффект просмотра карты для линейного макета - PullRequest
0 голосов
/ 23 января 2019

Как добавить эффект просмотра карты для линейного макета

У меня есть карта Просмотр

 <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:id="@+id/eventListRootId"
            card_view:cardElevation="@dimen/dimen_card_elevation"
            card_view:cardCornerRadius="@dimen/dimen_card_CornerRadius"
            card_view:cardPreventCornerOverlap="false"
            style="@style/style_card_view">

    </android.support.v7.widget.CardView>

Как добиться того же эффекта впросмотр списка, возможно ли использовать селекторы

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:card_view="http://schemas.android.com/apk/res-auto"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical">

</LinearLayout>

Ответы [ 2 ]

0 голосов
/ 23 января 2019

Просто используйте тему CardView в качестве стиля LinearLayout. В случае необходимости каких-либо изменений, просто создайте новую тему и расширьте ее из CardView theme.

0 голосов
/ 23 января 2019
<android.support.v7.widget.CardView 
xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:id="@+id/card_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/rel1"
    android:layout_gravity="center"


    android:layout_margin="10dp"
    android:layout_marginTop="10dp"

    android:clickable="true"
    android:foreground="?android:attr/selectableItemBackground"
    android:transitionName="open_mediaplayer"
    card_view:cardCornerRadius="4dp"
    card_view:cardElevation="3dp"

    >

   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:card_view="http://schemas.android.com/apk/res-auto"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical">

</LinearLayout>
</android.support.v7.widget.CardView>

Вы можете добавить просмотр списка внутри линейного макета для достижения

...