Reputation: 411
How To Hide/Remove Action-bar Without Hiding A Tabs Layout
MainActivity.cs
public class MainActivity : FragmentActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
string[] AllTabs = { "First Tab", "Second Tab" };
Navigation Mode
ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
var pager = FindViewById<ViewPager>(Resource.Id.pager);
var adaptor = new GenericFragmentPagerAdaptor(SupportFragmentManager);
adaptor.AddFragmentView((i, v, b) =>
{
var view = i.Inflate(Resource.Layout.tab, v, false);
var textsample = view.FindViewById<TextView>(Resource.Id.txtText);
textsample.Text = "This is First Page";
return view;
});
adaptor.AddFragmentView((i, v, b) =>
{
var view = i.Inflate(Resource.Layout.tab, v, false);
var textsample = view.FindViewById<TextView>(Resource.Id.txtText);
textsample.Text = "This is Second Page";
return view;
});
pager.Adapter = adaptor;
pager.SetOnPageChangeListener(new ViewPagerListenerForActionBar(ActionBar));
for (int j = 0; j < AllTabs.Length; j++)
{
ActionBar.AddTab(pager.GetViewPageTab(ActionBar, AllTabs[j]));
}
}
}
When i use ActionBar.Hide() Everything(ActionBar And Tabs) Are Hide.
I Use :
public class GenericFragmentPagerAdaptor : FragmentPagerAdapter
And
public class GenericViewPagerFragment : Android.Support.V4.App.Fragment
I Want To Hide This Part
Upvotes: 0
Views: 412
Reputation: 10831
When i use ActionBar.Hide() Everything(ActionBar And Tabs) Are Hide.
Because the tabs are a part of the action bar. When you are hidding the action bar, you are hidding everything.
How To Hide/Remove Action-bar Without Hiding A Tabs Layout.
You can achieve that by using following codes:
ActionBar.SetDisplayShowTitleEnabled(false);
This will hide the title bar part of the action bar.
Upvotes: 1