简体   繁体   中英

custom Holo theme for tab

i am trying to create a tab as following which is a Holo Light theme but as i am using android 2.3.6 i got to create it on my own.

在此输入图像描述

the problem i am facing is i am bot be able to create the blue bottom like here is the code so far in a drawable , can any one tell me how to create the bottom border for the same ?

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:top="63dp">
        <shape android:shape="rectangle">
            <solid android:color="#898989" />
        </shape>
    </item>
    <item android:top="63dp" android:bottom="3px">
        <shape android:shape="rectangle">

            <solid android:color="@color/app_background" />
        </shape>
    </item>
    <item android:left="@dimen/tab_space" android:right="@dimen/tab_space"> 
        <shape android:shape="rectangle">           

            <gradient android:angle="90" android:startColor="#d9d9d9"
                android:endColor="#dfdfdf"/>        

            <!-- this is create a border but on every side -->
            <stroke android:width="3px" android:color="#38c0f4" />



        </shape>
    </item>

</layer-list>

so wht i dont know is to create

1) bottom stroke 
2) shadow under each tab 

You could just set a 9 patch image as the background image. And this image could contain a stroke.

Here is A good post covering what I believe you are asking: http://android-developers.blogspot.se/2011/04/customizing-action-bar.html .

Sorry for the short answer. But I manly wanted to post to tell everyone that Actionbarsherlock is only for actionbar, it will not give you a holo theme for tabs etc . So those who can, please down vote that answer..

Even if this is not totally on topic of your question, I suggest to migrate your project to ActionBarSherlock . ActionBarSherlock lets you use all the ICS Actionbar Apis with earlier API-Levels and brings the ICS Actionbar Style to all Devices with at least Android 2.2.

Using this project will make it very easy to move your app to Ice Cream Sandwich compatibility, and solve your current design problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM