Number of tabs in ActionBar - java

Android's ActionBar has a mode NAVIGATION_MODE_TABS. Using ActionBarSherlock 3.5.1 I have set this ActionBar and addded 5 tabs. On 2.x devices I see all tabs without horizontal scrolling. On 4.0.x I see only 3 tabs with scrollable layout. NAVIGATION_MODE_TABS of ActionBar can contain max 3 tabs in ICS? If yes, could I hack this somehow? I know, i could create custom TabHost, but it would be quite time consuming to implement it with ViewPager between tab views.

You don't need to hack anything. The ActionBar tabs have specific layout parameters that you can change pretty easily through a custom style. Google uses their own style to set them in the first place. You should take a look at this on creating custom styles. http://android-developers.blogspot.com/2011/04/customizing-action-bar.html Since you want them to look like they way Jake Wharton has them set in ActionBarSherlock, then you could make things even easier for yourself and just rip his styles out.

I had the same problem with action bar sherlock, and this post helped me.
How to manage the width of ActionBar navigation tabs?
Important part is
<style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
<item name="actionBarStyle">#style/Widget.Styled.ActionBar</item>
<item name="android:actionBarStyle">#style/Widget.Styled.ActionBar</item>
</style>

Related

Overlay image on Action Bar

How do I overlay image over an Action Bar and status bar? Here is what I want it to look like -
I read this but it gives different results than what I want. The Action Bar still has some opacity and the status bar has no effect at all.
Is there any way to do this?
Add these two lines of code to your styles-v21.xml file:
<item name="android:windowTranslucentStatus">true</item>
<item name="windowActionModeOverlay">true</item>
Edit:
You want it in the v21 file because Android versions below 5.0 don't support this.
Also...for Material Design, you should be using a ToolBar not an Action Bar. Here's how to change the color of a Toolbar.
toolbar.getBackground().setAlpha(0);
Check this answer.
This one worked perfectly in my project.
This library is also great to explore:
https://github.com/ManuelPeinado/FadingActionBar

ActionBar animation issues

I am using the ObservableScrollView library to show and hide the ActionBar as you are scrolling up and down an activity. This works well but when the ActionBar is animating sliding in or out a blank area at the bottom of the screen about the size of the ActionBar is briefly pushed up.
After searching similar issues the suggested solution is to the following line to onCreate():
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
This has had no visible effect and the issue is still present.
Solved by setting my ActionBar to overlay content in the XML style.

How can I use a custom layout between the ActionBar and the Tabs?

I want to have a custom piece of layout between my ActionBar and the Tabs. Is there any way to do this? Maybe a custom view in the ActionBar, or split tabs?
This custom part possibly means I have to adjust the height of the actionbar. I wasn't able to do that either.
So is there a way to get the app working like I designed?
Image

Implement a bar with some buttons in android

I'm having some difficulties to reach a way of implementing an layout that i want for a android project. I have to make a layout like this:
This bar is at the top of the android screen over a map of google and each icon are a button. The map is already in the layout at this time.
Whats the simple way of doing this with android layout?
After that and not so important at this time, after click each button i have to open a rectangle with some options to fill (text boxs and dropdown lists) but i know that i can do this with a alert dialog. Is this the best way for doing this part?
Regards for the help
you can use third party libraries for this. ActionBarSherlock is the library which you can use.
Here's a link Click here to download
and for tutorial follow this link.
thanks
You can use an Action Bar, and overlay it on top of the map.
To enable overlay mode of the action bar, you have to create a custom theme and modify some values:
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="#android:style/Theme.Holo">
<item name="android:windowActionBarOverlay">true</item>
</style>
</resources>
More information on this in this android documentation

navigation in actionbar sherlock

I would like to implement the navigation with options like left and right button that are displayed in following URL. I found the Tab Option for android is possible via Action Bar and Tab Host Control. But I can not find the option with those two button actions.
Navigation in a UItoolbar in iOS
I also tried this by using Linear Layout and horizontal Scrollview concepts but the UI are not comfort as i wish . So If you find Anything Kindly do the needful.
If you want useing SlideNavigation use this library as i used this in my app for create Navigation SlideNavigaiton
and if you want Navigation Ontab you can use scrollable tab as you can see in sherlock actionbar sample and on other way you can Hide actionBar and create custom layout with scrollable contetn for your aim
hope to be usefull :)

Categories