8

i'm using the sherlock actionbar library in order to support many devices . i have a viewPager which has 3 fragments :

  • one with a listView , each item has a textView and an imageView
  • the second has a gridView , each item has a textView and an imageView
  • the third just has a textView for now.

as i've heard in google IO videos (and since Lint tells me) , it's recommended to have the next style being used for all of the activities:

<resources xmlns:android="http://schemas.android.com/apk/res/android">

  <style name="AppTheme" parent="@style/Theme.Sherlock">
    <item name="android:windowBackground">@null</item>
  </style>

</resources>

this has worked for me on many devices .

however , on the emulator , using version 2.3.3 , and on galaxy nexus , when i scroll (either the viewPager or any of the adapterViews) , everything just smears , so i get a lot of white pixels as if nothing was refreshed.

i've even tried to set android:cacheColorHint="#00000000" for all of my adapterViews , but it still occurs.

what is going on? how can i fix this thing ? i like adding the above since it removes the ugly gradient background of galaxy S3 that appears for every app.

halfer
  • 19,824
  • 17
  • 99
  • 186
android developer
  • 114,585
  • 152
  • 739
  • 1,270
  • what about a solid black background? – zapl Aug 27 '12 at 23:21
  • it wrote an error :"Error: Color types not allowed (at 'android:windowBackground' with value '#ff000000' ..." ,so i've tricked the compiler and gave it a color from the res folder , and then it worked , but i don't remember what was the reason for the suggestion , so i'm not sure if that helps . all i remember is that romain guy was the one lecturing about it. anyway , why don't you put your answer instead of putting a comment? – android developer Aug 28 '12 at 06:00
  • Hmm you know better what you did there to get a solid background, so IMO you should write what you did as answer :) – zapl Aug 28 '12 at 14:10
  • i'm not sure it helps , since i don't remember what does this optimization do . i think it's a better way to remove/set the background of the activity than setting it for the layout itself . – android developer Aug 28 '12 at 14:59

1 Answers1

11

You should only set the background to nul if you cover it with something else. Either: - Set the background to null in the theme and add a new background in your layout or - Set the background in your theme to the color/image you want.

Romain Guy
  • 97,993
  • 18
  • 219
  • 200