Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I'm trying to override the GetPageWidth method of the MyAdapter class (inherited from FragmentPagerAdapter) so that it returns 0.5 (50%, so that I can get two pages side by side within a single ViewPager).
Java Documentation: https://developer.android.com/reference/android/support/v4/view/PagerAdapter.html#getPageWidth(int)
public override float GetPageWidth(int p0)
Attached is test case.
Created attachment 2980 [details]
Not up to date on all my Android stuff, be research indicates this should work.
Created attachment 2982 [details]
is it possible that you only get your side-by-side behavior on tablets? Attached is a screenshot of your app running on my Nexus 10, and the Fragment/Pager demo does show side-by-side Fragments, each taking 50% of the screen.
What device are you running your app on?
Created attachment 2983 [details]
For that matter, I get proper 50% side-by-side behavior on my Galaxy Nexus (Android 4.1.2). Perhaps I need to try an older device?
Hello Mr. Pryor, I'm the guy who filed the "bug".
I'm running it on an Asus Tranformer TF700T, 10" screen.
I was wondering if maybe using the Fragments/ViewPager through
the Support4 library, instead of directly, has something to do with it ?
Is there a way to use Fragments/ViewPager without Support4, which I
believe is for backward compatibilty (with older versions of Android)
anyway, which I do not need (my target is 4 and up).
Pierece, you do not need to keep the test case private, if it helps matters, as it has no propietary code (its a direct example from github, published by Jonathan Pryor himself).
Which Android version is the Asus Transformer running?
According to the specs page, it's running Android 4.0:
Would it be possible to get a screenshot of what you're seeing? You can do that through the `ddms` or `monitor` Android SDK programs.
> I was wondering if maybe using the Fragments/ViewPager through
> the Support4 library, instead of directly, has something to do with it ?
This doesn't make sense to me; the attached project is using Mono.Android.Support.V4.dll ("android-support-v4.jar"), and it works for me...
> my target is 4 and up
This needs more context. Do you mean API-4 (Android 1.6) and up? Or Android 4.0 (API 14) and up? There's a large difference there...
If you can target Android 4.0 and later (API 14+), then you don't need the support library, you can use the corresponding Android.App and related types instead. I don't know if this will work, but it would certainly be interesting to know the result.
Note that there some API incompatibilities between the Support types and the API-14 types, so some work will be needed to migrate between them.
> Which Android version is the Asus Transformer running?
> Would it be possible to get a screenshot of what you're seeing? You can do
> that through the `ddms` or `monitor` Android SDK programs.
I'ts just a ViewPager Widget that takes of most of the screen, centered, and within the ViewPager is its contents: it displays one page at a time, where each page is a simple list. It pages ok and everything.
The GetPageWidth method is never even called (my log messages within it never fire).
>> I was wondering if maybe using the Fragments/ViewPager through
>> the Support4 library, instead of directly, has something to do with it ?
> This doesn't make sense to me; the attached project is using
> Mono.Android.Support.V4.dll ("android-support-v4.jar"), and it works for me...
You answered this below, stating:
"If you can target Android 4.0 and later (API 14+), then you don't need the
support library, you can use the corresponding Android.App and related types
instead. I don't know if this will work, but it would certainly be interesting
to know the result."
I will do this right now. Just to point out, if using Android 3.0 (API 11) and
up and using "normal" fragments (not through support lib), then you need to derive from regular Activity (not FragmentActivity).
I'm confident this will work for me and report back with my findings.
>> my target is 4 and up
> This needs more context. Do you mean API-4 (Android 1.6) and up? Or Android
> 4.0(API 14) and up? There's a large difference there...
Sorry, I mean Android 4.0 (API 14) and up.
Well its working now. The only thing I did was I copied the android-support-v4.jar file from the \android-sdk\extras\android\support\v4 directory, where previously I just grabbed the first one I found in a file search of my hard drive (after closer look they are different sizes, and so not identical to the "official" sdk jar).
I guess while I got ya on the line, do you know why ViewPager exists exlusively in the android.support.v4 namespace (I couldn't find a ViewPager in Android.App or anywhere else !?).
It appears that all the classes associated with fragments are scattered between the support library and the regualar App library (some exits in both places, where other are exlusive) ? Very confusing and frustrating.
Thank you for your help with this, Dan.
Here is my formal question about the "missing" FramePagerAdapter
Looks like this isn't a bug in Mono for Android, as per Comment #10.