Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make custom theme use null background (Android lint suggestion)

Im reading about the new Android Lint rules, and I find to prevent overdraw I should make my layouts with a background use a theme with null background, to prevent a background to be drawn if Im just gonna overwrite it. The problem is, how do I define a custom theme with null background?

Fail attempt 1 (doesn't compile):

<style name="NoTitleBarNoBackground" parent="@android:style/Theme.NoTitleBar">
        <item name="android:background">null</item>
</style>

Fail attempt 2 (warning persists):

<style name="NoTitleBarNoBackground" parent="@android:style/Theme.NoTitleBar">
        <item name="android:background">#00000000</item>
</style>
like image 829
pgsandstrom Avatar asked Dec 19 '11 14:12

pgsandstrom


1 Answers

You can try this:

<style name="CustomTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowBackground">@null</item>
    </style>

Hope this helps!

like image 107
Dimitris Makris Avatar answered Sep 30 '22 10:09

Dimitris Makris