简体   繁体   中英

Android ViewPager not filling screen on Galaxy Nexus only

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:

带有ViewPager问题的Galaxy Nexus的屏幕截图

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM