I'm using ActionBarSherlock in my application. I would like to use icons/images in the actionbar instead of the default tabs. But unfortunately the images/icons I used by using .setIcon(), I find that there is a lot of padding being applied before and after the image/icon on each tab, thus making it look ugly.
Current tabs image
Could any please guide as to what needs to be done for this?
Intended tabs image
Related
I am trying to make custom profile page , Tabbed layout is embed within ActionBar , and Tabs can change both with sliding and click on other tab.
I just started playing with ActionBar , and didn't understood what are major differences between Sherlock / simple ActionBar.
Here is what i am trying to make right now:
Any Help in any form appreciated , There is no similar Github lib or helper code at net/SO , so i can't figure out how i should get started
You will need to use a TabLayout along with a ViewPager. These are standard controls. Google it or see here for an example of how to use it. ActionBarSherlock isn't used anymore. Instead we use a Toolbar.
I'm developing an android app and recently we decided to mix up the design and switch our main screen to a view pager with tabs on top (actually in the actionbar).
To place the tabs on top I was thinking of using a custom actionbar layout and for the tabs to use the PagerSlidingTabStrip library but I also need that instead of text to have an icon that changes colour as you swipe (if the page is selected or not), as it is used on the Facebook app or Tinder
Does anyone have any suggestion for this? I saw that there was a branch made on the tab library that should have done exactly this, but I couldn't get it to work.
OK, found how to add the image to the tab, had to go a bit through the code of the PagerSlidingTab library.
The PagerSlidingTab contains an interface called IconTabProvider that needs to be implemented by your ViewPager's adapter. Implemented that and for each position you can provide a different icon.
My only problem now is that I need to have a different coloured icon based on if a tab is selected or not, with a slow transition between the two (just like on Tinder and on Facebook).
LE: Apparently got lucky and there is a fork of the tab strip library that can be found here. You just need a drawable resource created like this:
<item android:state_selected="true" android:drawable="#drawable/ic_twitter"/>
<item android:drawable="#drawable/ic_twitter_of"/>
It will change whenever you select a new page, but there is not smooth transition between the on and off icon.
LE 2:
Found another branch that has the smooth tab transition (uses the alpha property to show a nice transition) and it can be found here. The only problem is that it doesn't support a state switching icon, so I decided to combine the two forks. Thanks to both creators for the awesome work, saved me a huge amount of time :).
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'm working on a project with a tab navigation. Because it should be compatible with Gingerbread I'm using Actionbar Sherlock for this approach. My Problem is that one tab is too short an one letter of the word is shown in a second line:
What can I do to set the width of an tab so that it fits the word?
Thanks for your help!
You can reduce font size in tabs to make it according to your needs, but his solution has its limits.
One of other solution is that, you can use ViewPagerIndicator library, It has tabs, which can scroll if they do not fit in screen. See example code from following link
https://github.com/JakeWharton/Android-ViewPagerIndicator
Please take a look at the image above. You can see that the navigation tabs in Actionbar of the Google Play market screenshot is like 2/3rd the size of ActionbarSherlock Samples/Styled application. I have searched and searched but couldn't find an attribute that can change this. So how can I decrease the size of these nav tabs. It looks like a pretty easy way of saving some screen real estate.
That is not action bar tabs. That is an indicator for use with a ViewPager.
There is a rudimentary implementation of this in the support library (PagerTitleStrip) but it leaves A LOT to be desired. You should take a look at http://viewpagerindicator.com for a much more comprehensive implementation.