问题
I'm trying to create a ViewPager that takes up the entire screen. Inside each fragment of the ViewPager, I have an ImageView that displays a semi-transparent picture.
For some reason, when I try my solution on a Galaxy Nexus (4.0.4), it leaves a border on the left and right side of the ViewPager, as shown below:
I've tried this on the following devices and it does not give that problem:
- Nexus S (4.1.1)
- Nexus One (2.3.6)
- Evo 4G (CM7.2, 2.3.7)
- Android emulator
Would anyone be able to take a look at the simplified source code and help me out (especially if you have a Galaxy Nexus)? Thanks!
Btw, this is an attempt to solve an earlier question myself, for which I couldn't get a proper answer.
回答1:
I went through my code again and tried commenting/uncommenting sections to see if I could get rid of the problem.
I narrowed it down to the custom style I was applying to my activity. In it, I had the following item:
<item name="android:windowIsFloating">true</item>
Removing this item fixed the issue, although I still don't understand why. Maybe something related to this question - How to create a transparent activity WITHOUT windowIsFloating
I had originally included this item after reading the following question - How do I create a transparent Activity on Android?
Anyway, I hope this saves someone else a significant amount of time in debugging.
来源:https://stackoverflow.com/questions/12031233/android-viewpager-not-filling-screen-on-galaxy-nexus-only