You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.
I noticed a difference in the behaviour of fragment handling (using FragmentManager/-Transactions) between ABS and the regular Android framework plus android-support-v4.jar library:
I have a (Sherlock)FragmentActivity which hosts two fragments, one of which is full-screen visible at a time. Background style is transparent. When tapping on the activity window, the screen switches between the two fragments.
Before I used ABS, this has worked just fine. Now, since I introduced ABS (because I want to use the ActionBar), the first fragment persists on the screen, and on all subsequent clicks, I see the alternating two fragments plus the unwanted, persisting first fragment (at least when I use the transparent theme/style). This is when running on an Android 2.2 phone/emulator, it works fine with Android >= 4.0. Here is my sample code (differences between implementation without and with ABS in brackets [ ]):
I did neither define a main layout for the activity nor did I create a root view(group) programmatically in order to keep my source code compact. Instead, I do all the FragmentTransactions directly on the system-defined root view ID "android.R.id.content". This is officially encouraged by http://developer.android.com/guide/topics/ui/actionbar.html and therefore should work. Quotation:
Alternatively, if the tab content will fill the activity layout (excluding the action bar), then your activity doesn't need a layout at all (you don't even need to call setContentView()). Instead, you can place each fragment in the default root ViewGroup, which you can refer to with the android.R.id.content ID (you can see this ID used in the sample code below, during fragment transactions).
If I use a main layout or define a root View(Group), it works fine, so this is a workaround for the moment. But I still would prefer to be able to use my original slender code.
The text was updated successfully, but these errors were encountered:
I noticed a difference in the behaviour of fragment handling (using FragmentManager/-Transactions) between ABS and the regular Android framework plus android-support-v4.jar library:
I have a (Sherlock)FragmentActivity which hosts two fragments, one of which is full-screen visible at a time. Background style is transparent. When tapping on the activity window, the screen switches between the two fragments.
Before I used ABS, this has worked just fine. Now, since I introduced ABS (because I want to use the ActionBar), the first fragment persists on the screen, and on all subsequent clicks, I see the alternating two fragments plus the unwanted, persisting first fragment (at least when I use the transparent theme/style). This is when running on an Android 2.2 phone/emulator, it works fine with Android >= 4.0. Here is my sample code (differences between implementation without and with ABS in brackets [ ]):
I did neither define a main layout for the activity nor did I create a root view(group) programmatically in order to keep my source code compact. Instead, I do all the FragmentTransactions directly on the system-defined root view ID "android.R.id.content". This is officially encouraged by http://developer.android.com/guide/topics/ui/actionbar.html and therefore should work. Quotation:
If I use a main layout or define a root View(Group), it works fine, so this is a workaround for the moment. But I still would prefer to be able to use my original slender code.
The text was updated successfully, but these errors were encountered: