Gautam
Gautam

Reputation: 4026

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:

Screenshot of Galaxy Nexus with ViewPager problem

I've tried this on the following devices and it does not give that problem:

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.

Upvotes: 0

Views: 982

Answers (1)

Gautam
Gautam

Reputation: 4026

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.

Upvotes: 1

Related Questions