I haven't received any responses on stackoverflow about this, so am giving it a shot here.

My app, which is fairly large and complex (hard to post meaningful code) uses as its main view a ViewPager with a FragmentPagerAdapter. Since the minSDK is 14, I originally wrote it to use the native Fragment and related classes (ViewPager from support.v4 and FragmentPagerAdapter from support.v13). This has all been working perfectly for a long time.

Recently I decided to build in more compatibility, mainly for themes, by using the appcompat.v7 library. However, using this library required that I use the Fragment and FragmentPagerAdapter, etc. classes from the support.v4 library (meaning that I also had to change my Activity to a FragmentActivity, call getSupportFragmentManager, etc.).

Making no more than these changes, my ViewPager comes up as a blank screen; all I see is the ViewPager's background color; my fragments' views are not displayed! What's really strange is that by putting in various breakpoints, I can see that almost everything is working underneath as far as my fragments' life-cycle methods being called, etc. I can swipe back and forth across the screen and the fragments appear to be swapped in and out as expected. It is particularly telling, however, that in various custom views that I have, the onMeasure and onDraw methods are never called!

Does anyone have any idea of what would be preventing the ViewPager from actually drawing its views? If I revert the code to use the native fragment support and associated supporting classes, everything shows up, which means that if there is something wrong on my end it must be extremely subtle.

(Just to throw in some confusion, there is another activity in the app that also uses a ViewPager with fragments, and it continues to work with either the native or support library classes. (I'm about to throw in the towel and just forget this whole update.))

Doug Gordon

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to