I have implemented clickable Recyclerview
item and set android:background="?selectableItemBackground"
for click effect but while inspecting code I found this lint issue.
Lint warning :
Possible overdraw: Root element paints background ?selectableItemBackground
with a theme that also paints a background
Any idea to solve this warning?
My xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:clickable="true"
android:orientation="vertical"
android:padding="@dimen/row_padding">
//...
</LinearLayout >
By default, a theme has android:windowBackground
attribute specified, which specifies, as the name implies, the background of the window, where your activity is being launched.
This lint warning just tells you following:
Hey! I see your theme has a
windowBackground
applied, and your root layout draws some other drawable on top of window background, making window's background pointless - thus overdrawing pixels needlessly.
Nulling out windowBackground
would make lint not to complain:
<style name="AppTheme" parent="...">
...
<item name="android:windowBackground">@null</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With