码迷,mamicode.com
首页 > 移动开发 > 详细

[Android]Tab

时间:2014-10-16 23:27:53      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:android

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_alignParentBottom="true"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="0.0dip"
            android:layout_weight="1.0" />
        <TabWidget 
    		android:id="@android:id/tabs"
    		android:layout_width="fill_parent"
    		android:layout_height="wrap_content"
    		android:layout_weight="0.0"
    		android:visibility="gone"/>
     	<RadioGroup
        	android:id="@+id/radioGroup"
            android:layout_width="fill_parent"
            android:layout_height="60dp"
            android:layout_gravity="bottom"
            android:gravity="left"
            android:background="@drawable/bg_bottom_tab"
            android:orientation="horizontal" >
           	<RadioButton
            	android:id="@+id/homepage"
                style="@style/bottom_tab_style"
                android:drawableTop="@drawable/bg_tab_homepage"
                android:tag="HomePage"
                android:text="@string/HomePage" />
          	<RadioButton
            	android:id="@+id/sell"
                style="@style/bottom_tab_style"
               	android:drawableTop="@drawable/bg_tab_homepage"
                android:tag="Sell"
                android:text="@string/Sell" />
          	<RadioButton
            	android:id="@+id/buy"
                style="@style/bottom_tab_style"
                android:drawableTop="@drawable/bg_tab_homepage"
                android:tag="Buy"
                android:text="@string/Buy" />
          	<RadioButton
            	android:id="@+id/donate"
                style="@style/bottom_tab_style"
                android:drawableTop="@drawable/bg_tab_homepage"
               	android:tag="Donate"
               	android:text="@string/Donate" />
         	<RadioButton
            	android:id="@+id/more"
                style="@style/bottom_tab_style"
                android:drawableTop="@drawable/bg_tab_homepage"
                android:tag="More"
                android:text="@string/More" />
   		</RadioGroup>
    </LinearLayout>
</TabHost>

styles.xml中配置

<style name="bottom_tab_style">
        <item name="android:textSize">15.0dip</item>
        <item name="android:textColor">#ffffffff</item>
        <item name="android:gravity">center_horizontal</item>
        <item name="android:background">@drawable/selector_radiobutton</item>
        <item name="android:paddingTop">8.0dip</item>
        <item name="android:button">@null</item>
        <item name="android:layout_weight">1.0</item>
        <item name="android:drawablePadding">5.0dip</item>

selector_radiobutton.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/bg_tab_radiobutton_s" android:state_enabled="true" android:state_focused="true" android:state_pressed="false"/>
    <item android:drawable="@drawable/bg_tab_radiobutton_d" android:state_enabled="true" android:state_pressed="true"/>
    <item android:drawable="@drawable/bg_tab_radiobutton_d" android:state_enabled="true" android:state_checked="true" />

</selector>


bubuko.com,布布扣


bubuko.com,布布扣


bubuko.com,布布扣


bubuko.com,布布扣



bubuko.com,布布扣



[Android]Tab

标签:android

原文地址:http://blog.csdn.net/sunnyyoona/article/details/40155929

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!