I have Actionbar Sherlock and SlidingMenu set up in my project. I want the menu to slide in under the actionbar, so I set:
setSlidingActionBarEnabled(false);
Though, when I have the action bar Navigation Mode set up with tabs:
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
They stick with the action bar instead of sliding away. That causes the issue of being able to switch tabs and the view pager switching while the menu stays open. Along with it not being the aesthetic I am going for.
Is it possible for the tabs to slide away from the action bar with the menu? Or would it just be more practical to set up a custom implementation with radio buttons?
It's not possible to have the tabs slide when you are using NAVIGATION_MODE_TABS.
The alternative is to use the ViewPagerIndicator library and the TabPageIndicator mode from that. That way the tabs are a part of the activity layout, and will slide. The downside is that the tabs won't get embedded in the action bar on larger devices or when a device is in landscape.
Related
I'm currently working on an Android application with two ActionBar Tabs.
I have three questions:
1) How can I make the ActionBar Tabs to appear on the bottom of the app (under the fragments)
2) Can I make a WebView in a Navigation drawer (menu)
3) How can I let the ActionBar menu appear on the right side of the ActionBar?
Thanks for answering
EDIT:
With an ActionBar menu, I'm meaning the menu on the middle of this Picture:
http://static.androidnext.de/Facebook-for-Android.jpg
How can I make the ActionBar Tabs to appear on the bottom of the app (under the fragments)
Sorry, that is not possible with action bar tabs. You cannot even control if they show up as tabs at all, let alone their position.
Can I make a WebView in an ActionBar Menu (the menu for example Facebook has the main Navigation)
What you are referring to is a navigation drawer. Putting a WebView in a navigation drawer is technically possible but is unlikely to meet Google's design guidelines for navigation. In your case, given your third question, you presumably are not using this for navigation.
How can I let the ActionBar menu appear on the right side of the ActionBar?
That depends on what you are using for the navigation drawer. DrawerLayout supports this:
Drawer positioning and layout is controlled using the android:layout_gravity attribute on child views corresponding to which side of the view you want the drawer to emerge from: left or right. (Or start/end on platform versions that support layout direction.)
Is there any way, how to set that the Navigation Tabs will be displayed below Action-bar every-time? On my phone is the view like I want it to be - tabs below Action-bar - but on tablet are the tabs inside the Action-bar.
Is there any way how to accomplish that?
You can not force tabs to be below the action bar. You can, however, roll-your-own with a ViewPager and PagerTabStrip. See the post below:
Force stacked tabs
Also, the Android Developers docs have some info:
http://developer.android.com/training/implementing-navigation/lateral.html#PagerTitleStrip
I am using action bar with help of android-support-v7-appcompat and also using Navigation drawer over it.
In one of my fragment if I use ActionBar.Tabs then the tabs overlaps the navigation drawer and the drawer gets below the ActionBar tabs.
How can I make the action bar like in google play application or Google movie application.
The tabs should also go behind like the fragment. How can I do the same with android-support-v7-appcompat Libs
For Tab bar try ViewPagerIndicator http://viewpagerindicator.com/
This has a very good implementation for tab bar.
When we use default tab bar with actionbar, in landscape mode it will be merged into single row. So its better to use the above library.
I think you would be better off using a library like ViewPagerIndicator. The ActionBar is recognized as decor and is shown over top of the window, and the DrawerLayout is drawn as an object in the window.
Not sure if they're going to fix it in a future revision, but ViewPagerIndicator is pretty easy to set up and customize anyway.
Also, go to this question for better achievement getting-drawerlayout-to-slide-over-the-actionbar
Roman Nurik says that the Navigation Drawer should not be used with the Action Bar tabs.
The discussion is here https://plus.google.com/u/1/116515063230772720916/posts/8dWEkFcbTFX
I am using both actionbarsherlock and slidingmenu objects
the point is, I want my menu - which is sliding to do the following
push the currently visible screen aside, along with its actionbar
the fragment that is displayed inside the menu to have a different actionbar
how do i do that?
I've set everything to make 1 work
but the fragment is missing the menu - how to add it ?
You can't have multiple ActionBar in the same activity.
Best thing you could probably do, is not make the ActionBar slide with the menu, while starting/finishing an ActionMode when you open up/close the sliding menu.
Or if you really want to slide the ActionBar, then simply create a view in the menu fragment that will looks like an action bar.
You probably can use a custom layout in your actionbar and manipulate it by adding an animation so that it looks like the actionbar slides out and it is pushed by another actionbar when the menu slides in. The object would be the same, but the user perception will be of a sliding action bar pushing away the previous one.
I want to use Actionbarsherlock to make tabs aligned at the bottom of a layout. Where the fragment views load above it instead of below it.
How would this be done? currently in onCreate I am doing
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
getSupportActionBar().setDisplayShowHomeEnabled(false);
getSupportActionBar().setDisplayShowTitleEnabled(false);`
and do not see an obvious function in getSupportActionBar() that facilitates its position onscreen.
Insight appreciated
This cannot be done. The tabs are built-in to the action bar which always remains at the top of the screen. The action bar behavior itself is dictated by the native action bar that's built-in to Android. ActionBarSherlock only mimics its behavior on pre-ICS.
If the native action bar does not support a feature then ActionBarSherlock will not be able to support it either.
A simpler way to do this would be to place a TabWidget at the bottom of the layout and theme them to look like the ICS-style tabs.