android - How to display fragment *over* tabulation setup as Play Store Settings does? -
my application has 3 main screens (1 fragment each) presented in action bar compat navigation_mode_tabs.
from action bar , menu, user able reach
- settings,
- profile,
- credit card
- etc.
which less used functionality. feel (from android guidelines) should not regrouped inside 4th tabulation (as currently).
how display less-used fragments similar feeling way google play creates , displays screen settings (leaving tabs mode)? need secondary activity? can stay in same activity (best case me) , how?
create second activity, can show other fragments. can put flag in intent, need startactivity() method, can check fragment should shown in otheractivity. navigation need edit manifest this, set activity hirarchy:
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/mytheme" > <activity android:name="com.test.activitymain" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="com.test.otheractivity" android:parentactivityname="com.test.activitymain" > <!-- parent activity meta-data support api level 7+ --> <meta-data android:name="android.support.parent_activity" android:value="com.test.activitymain" /> </activity> </application>
you have add line code oncreate() method in otheractivity see navigation button:
getsupportactionbar().setdisplayhomeasupenabled(true);
otherwise can stay in activity, replace fragment , hide() actionbar, hide() animation looks little bit strange. besides won't have button , it's not best practice.
Comments
Post a Comment