【发布时间】:2019-03-23 17:02:33
【问题描述】:
创建我的 RecyclerView 后,我注意到在尝试将涟漪效果应用于我的 RecyclerView 项目布局时出现此警告。为什么在各种教程中出现此警告android:background="?android:attr/selectableItemBackground" 是他们告诉人们用来获得连锁反应的东西?有谁知道应该怎么做才能消除这个警告?
可能的过度绘制:根元素使用同时绘制背景的主题绘制背景“?attr/selectableItemBackground”(推断主题为“@style/AppTheme”)
RecyclerView 项目布局 (XML)
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tv_RVItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorPrimary" />
styles.xml 中的相关主题
<style name="AppTheme" parent="android:Theme.Material.Light.DarkActionBar">
</style>
Manifest 中定义的应用
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme">
【问题讨论】:
标签: java android xml android-recyclerview