Android FragmentTransaction: How to generate an overlay slide in and move existing Fragement to left -
i'm trying following. create new fragement b (menu), slide in right, , want move (no hide or replace!) shown fragment left.
i got transaction fragment b right, fragment doesn't change position @ all. seems like, fragmentmanager
doesn't know fragment exists (fragment not added dynamically, it's defined in xml).
main_screen_layout-xml
<relativelayout //... android:id="@+id/main_screen" tools:context=".mainactivity" <fragment android:id="@+id/map_screen" android:layout_width="fill_parent" android:layout_height="fill_parent" class="com.google.android.gms.maps.supportmapfragment" > </fragment>
fragmenttransaction
fragmentmanager fragmentmanager = getsupportfragmentmanager(); fragmenttransaction ft = fragmentmanager.begintransaction(); ft.add(r.id.main_screen, new menufragment(), menu_fragment); //adding fragment b ft.setcustomanimations(r.anim.slide_in_right, r.anim.slide_out_left_cut); ft.addtobackstack(null); ft.commit();
fragment exists in fragementmanager
, can hide it, that's not goal
fragment fragmenta = fragmentmanager.findfragmentbyid(r.id.map_screen); ft.hide(fragmenta); //hide fragmenta
what doing wrong?
some notes:
- i'm using support libaries (android.support.v4.app.fragmentmanager..), testing on api 17
- as mentioned before, didn't declare fragmenta
fragmentmanager
(tried so, says fragment exists) - fragment (as can see in xml) google map class
supportmapfragment
- the animation xml working, that's why didn't post
i'm not sure if looking for, check out sliding menu library... allows 1 slide in fragment left or right while shifting center content fragment.
Comments
Post a Comment