Я пытаюсь использовать selectableItemBackground
в recyclerview
, я тестирую простую демоверсию, она работает.android: background selectableItemBackground теперь работает
Вот макет и стиль:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground">
<ImageView
android:id="@+id/imageView"
android:layout_width="100dp"
android:layout_height="100dp"
app:srcCompat="@mipmap/ic_launcher" />
</LinearLayout>
</RelativeLayout>
Стиль:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
Когда я проверить еще один проект, он не работает, я ищу какие-то решения, один из решений сказать может быть стиль.
Но стиль решения был Theme.AppCompat.Light.NoActionBar
, я тоже использовал его.
Вот мой макет проекта, кто-нибудь может сказать мне, почему?
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground">
<ImageView
android:id="@+id/image"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="0dp"
android:src="@drawable/pink_circle" />
</RelativeLayout>
</RelativeLayout>
Стиль:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@android:color/holo_blue_dark</item>
</style>
спасибо @Marius Kaunietis, это выяснить, мою проблему, я не ожидал, что это простое, поистине спасибо. –