Creating tabs with different heights in Android - android

How I can create the following layout?

Give those tabs which has not been selected, a background that their top part is transparent and pretends to be shorter than the selected one.

Related

How to change the gap between icon and text?

Picture
To see the picture , please click the link at the top.
Here is a ViewPager + TabLayout。
I use the following code to create the tablayout.
firstTab.setIcon(R.drawable.tab_home_green).setText("HOME");
secondTab.setIcon(R.drawable.tab_explore_grey).setText("EXPLORE");
thirdTab.setIcon(R.drawable.tab_me_grey).setText("MIME");
Now the gap between icon and title is fixed, In the source the gap is private. I want to know how to change the gap value?
How to change the padding of each Tab?
Create and inflate a custom tab's layout.
You can also use view tag in xml for the space between the icon

How to create arrow type layout?

I have start and end date time fields that look like in picture below. Blue color shows active selection - if we select right then blue color goes to right and white color appears on the left and vice versa.
Hardest part is to create that arrow style in the middle. What should i use because buttons are rectangles and I don't know how it could be done.
It's easy. Just use ninepatch.
You can start there:
http://radleymarx.com/blog/simple-guide-to-9-patch/
you need a custom image according to what you ask, maybe extend ToggleButton for that but basically what you want is the same component when pressing on two different places on the same component will dispatch different events.
I would for example extend Linear layout, make it vertical layout, put two clickable textView\buttons with 9 patch images as background ,like suggested before, one for the white part and the other for the blue part. and replace the background image for any event u like.
you can also create a StateListDrawable with actions for selected and deselected and set the state of each drawable upon the right click

Android change of ActionBar tab from some width

I have one tough question. I am now playing with design of the Android application and I have the problem with way how the tabs are displaying from some width of display. I use ActionBarSherlock library and ViewPager for tabs.
The problem is that I use yellow color for ActionBar, black for tabs and again yellow for tab indicators, but when I look at the application on wider screen or in landscape mode (I guess approximately from width 400dp) I can't see the indicators, because tabs are hiden in action bar and indicator has exactly the same color. Is there som way how to change color of tab indicators from some display width?
I have tried to do it by making of layout-sw400dp/layout.xml, new 9patche's and new styles, but I can't make it work this way and I think now that it is impossible to do it this way. Do you have any idea how to do this?
Thank you very much in advance.
UPDATE
I have solved it in the following way. I have created folders drawable-w400dp and drawable-land (for ancient phones). Only phones where it will probably be displayed in the wrog way are black berry like androids.
Have you tried using the Action bar style generator. I used this and my tabs have highlights in both orientations http://jgilfelt.github.com/android-actionbarstylegenerator/ it generates 9patches and XML for you

How to make the instagram actionbar style for android?

I know how to make the gradient and the logo. But I don`t know how to add all that different borders and how to add the refresh icon (that also has some custom border around it).
Instagram Action Bar:
How is that possible?
You can do it by using a horizontal LinearLayout with 2 children, the left hand column with the logo and the right hand column with the refresh button. You can create a background drawable using the Shape XML:
http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape
I'd look at the provided ActionBar and ActionBarCompat. It has hooks for producing basic, as well as complex action bars.

How do I set the color for a tabview in android?

I want to change the colour of a tabview from the default grey (and black when not selected) to red and green when not selected.
In the tab Widget class I'm trying to set the colour using these functions
tabHost.setBackgroundColor(Color.RED);
tabHost.getTabWidget().setBackgroundColor(Color.GREEN);
But they don't work, its still the default colour. How do I manually set the background and tab colours of a tab widget in android? Also, is it possible to do it in xml?
See Step 4. at this blog, it's how I have done it, very simple, easy to change and tweak if you need to and it's all in XML.
Custom tabs in android tabhost

Categories

Resources