Reputation: 132
Android experts,
please help me in this issue. I have created two fragments aligned side by side for android tablet. When the user clicks on ListView
in left side, the relevant activity is loaded on right side. Now the problem is, I want to display action bar
in each of my activity screens, but in this screen the ActionBar
is not seen. As I am loading fragments on list item click
, I have my xml in this format
<LinearLayout>
<FrameLayout/>
--left fragment
<FrameLayout/>
--right fragment
</LinearLayout>
Now, if I put ActionBar
code like
<include android:layout="@layout/actionbar">
<LinearLayout>
<FrameLayout/>
--left fragment
<FrameLayout/>
--right fragment
</LinearLayout>
This is not displaying ActionBar
in the top. Please help me.
Thanks
Upvotes: 1
Views: 146
Reputation: 132
I achieved this by using FragmentActivity
. The code is as follows,
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(FragmentA.this.getParent().getID(), mNewFragment);
ft.addToBackStack(null);
ft.commit();
Upvotes: 1