I'm developing an app that is using "tabs". I have successfully implemented a design that uses these tabs in conjunction with a number of fragments.
however, I believe that these tabs look pretty ugly. I want to customize how they appear! I prefer them to appear as plain text next to eachother with a "|" between them and underline the tab that the user is one. Rather than the way they are currently designed which is each text per tab is separated evenly with a blue bar underneath it representing that it is selected.
I am not sure where to start. how can I go about doing this?
Check out the PagerSlidingTabStrip
http://www.androidviews.net/2013/04/pager-sliding-tabstrip/
https://github.com/astuetz/PagerSlidingTabStrip
You can hook it up to your viewpager and customize your tabs in many different ways.
Hope it helps!
I have a Viewpager and want to set title for the same. I am able to do this. But customizing the same is creating problems for me.
1). I dont want the default strip below the title instead I want my selection bar to be in that place. I know we can change color for the strip but is it possible to give a drawable for the same.
2). I only have 3 pages for ViewPager so I want all 3 titles to be visible at the same time.
3). Can we define the width for the strip below title
Please provide suggestions for the same. Ihave stuck in middle of this.
Thanks in advance.
I'm not sure if I understand correctly your first question, but try reading this post:
android: How to add icons/drawables to the PagerTabStrip from the Android Support Lib version 4?
my app is using using Sherlock action bar.
my designer gave me a new design.
the app logo need to be in the middle
2 action items to the left and 2 actionitems to the right of the logo
the app logo height is 1.5 the size of the actionbar (it suppose to be a little overflow)
is it possible to create a custom layout for the actionbar to implement this desing ?
or should i remove my actionbar and implement the design my own ?
if item #3 will be optional , does it changes your answers ?
Thanks
I'm sorry, but kick your designer in the...
He doesn't get Android at all and shouldn't design for Android. Either it's an ActionBar and then you should treat is as such and you (or your designer) should follow the common pattern on Android, or it is not.
If it is no ActionBar, please do not use an ActionBar (no matter which library) and create a custom design that deviates enough from an ActionBar so as not to confuse users!
Please forward your designer, and your manager to Android design patterns site at http://developer.android.com/design/patterns/actionbar.html . Also tell them that if they want Google to ever feature them, they pretty much have to adhere to these. With all failed use full screen layout and create a custom control on the top
I agree with other answers: that's not an action bar as defined by Android guidelines.
I'll just add that in case you can't go against the design decisions made (yeah, real-world projects sometimes suck and as a programmer you'll have to do what the client asks).
Go with your own implementation. I suggest simply creating a fragment with the appropriate listener interface (a common Android pattern, let the activity implement the interface, set the fragment's listener in onAttach).
If you want to implement this (and I pretty much agree with the other posters, that this is non-standard, and probably shouldn't be done).
You won't be able to create this style ActionBar with the standard APIs (or ActionBarSherlock for that matter) - since your UI is non-standard
You could create a RelativeLayout, with your icon in the center (centerInParent="true"). Then in the same layout, you could create a background, with width set to "fill_parent", and the height to 2/3 the size of your center icon (calculating this value in DP).
Then you can create ImageButtons for your 2 ActionItems to the left and to the right, then just put them in your layout relative to the center icon.
Bottom line, you probably should re-think your UI, to make this more standard to the design patterns specified by Android. If you still want to do it the way your designer asks, you will need to do a custom layout (using a RelativeLayout as I suggested is one way to accomplish the UI you are looking for).
You could create a RelativeLayout, with your icon in the center
centerInParent="true"
Then in the same layout, you could create a background, with width set to fill_parent, and the height to 2/3 the size of your center icon (calculating this value in DP).
I have googled this, most of the solutions are using:
1.TabHost with customized style which would cover the separate line between each tab to archive the requirement.
2.On the android developers website, there is a article is using Merge layout to put 2 buttons on top of the background image kind of archive what I want.(http://developer.android.com/resources/articles/layout-tricks-merge.html)
3.What about using button but style the looking like the example below? I don't need the selection, cause each item in the menu will be a button, which takes the user to another page.
I am wondering is there any other solutions apart from these two?
This is something want:
I don't need the menu likes a tab which has selected and unselected, they are better like a button always displaying in certain screen(activity).
Thank you.
You can use simple buttons, and provide any custom background for it. For such simple form as on your screenshot look for this link.
But #Janne write right thing - you should be very careful with transplanting controls from another platforms.
I'm trying to accomplish the style of buttons used in the yahoo fantasy football app. On the nav bar located at the bottom of the screen there are buttons. Now I've extracted the assets from the app so I know that the magnifying glass is of course an image, but there are two. A blue one and a grey one. However the button "underlay" which is transparent doesn't appear to be an image.
Example: http://i.stack.imgur.com/ASNzz.jpg
I want to replicate this type of button, with the following characteristics.
A gradient background (I know how to do this, but I want to be clear that #2 needs to be able to reflect a background that isn't a solid color)
A "button underlay" that is transparent with rounded corners, like the example.
Changing icons (magnifying glass)
And then of course, it being a button. More specifically launching another activity in my app.
I think that Yahoo has copied the iPhone TabBar style for that app, but it's a simple TabHost interface (here's the tutorial)
On the internet you can find many XML examples for the TabBar style, I suggest these ones (that in my opinion are the best)
https://github.com/AdilSoomro/Iphone-Tab-in-Android : the graphical best one IMHO
https://github.com/honcheng/ScrollableTabHost-for-Android : in this one the TabBar is horizonally scollable
http://www.anddev.org/code-snippets-for-android-f33/iphone-tabs-for-android-t14678.html : a very easy one to implement
But I have a thing to ask you: is for your application necessary to copy the iPhone style? I leave here the link to Londatiga's QuickActions which are the same style as the contacts app, twitter app, gallery app, and many many more - and it's a recommended style by the Google's engineers. It's more "androidish" ;)