android笔记---主界面(一)

本文详细介绍了如何使用TabLayout组件在Android应用中实现简洁高效的标签导航功能,包括自定义样式、布局和交互体验优化。
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:bar="http://schemas.android.com/apk/res/com.talented"
    android:id="@+id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#efefef"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <com.talented.actionbar.ActionBar
            android:id="@id/gd_action_bar"
            android:layout_width="fill_parent"
            android:layout_height="@dimen/gd_action_bar_height"
            android:background="?attr/gdActionBarBackground"
            bar:title="@string/app_name"
            bar:type="normal" />
<!--RadioGroup中同一时刻只有一个RadioButton被选中-->
        <RadioGroup
            android:id="@+id/numbers_radio"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="@drawable/tab_bg"
            android:orientation="horizontal" >

            <RadioButton
                android:id="@+id/action_radio_1"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:background="@drawable/blk_find_tab"
                android:button="@null"
                android:checked="true"
                android:drawableTop="@drawable/talented_tab_search"
                android:drawingCacheQuality="high"
                android:gravity="center"
                android:paddingBottom="3dp"
                android:paddingTop="3dp"
                android:text="@string/app_tab_name_1"
                android:textColor="@color/search_colorbg"
                android:textSize="12.0sp"
                android:textStyle="normal" />

            <RadioButton
                android:id="@+id/action_radio_2"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:background="@drawable/blk_find_tab"
                android:button="@null"
                android:checked="false"
                android:drawableTop="@drawable/talented_tab_person"
                android:drawingCacheQuality="high"
                android:gravity="center"
                android:paddingBottom="3dp"
                android:paddingTop="3dp"
                android:text="@string/app_tab_name_2"
                android:textColor="@color/search_colorbg"
                android:textSize="12.0sp"
                android:textStyle="normal" />
            
            

            <RadioButton
                android:id="@+id/action_radio_3"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:background="@drawable/blk_find_tab"
                android:button="@null"
                android:checked="false"
                android:drawableTop="@drawable/talented_tab_storage"
                android:drawingCacheQuality="high"
                android:gravity="center"
                android:paddingBottom="3dp"
                android:paddingTop="3dp"
                android:text="@string/app_tab_name_3"
                android:textColor="@color/search_colorbg"
                android:textSize="12.0sp"
                android:textStyle="normal" />

            <RadioButton
                android:id="@+id/action_radio_4"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:background="@drawable/blk_find_tab"
                android:button="@null"
                android:checked="false"
                android:drawableTop="@drawable/talented_tab_access"
                android:drawingCacheQuality="high"
                android:gravity="center"
                android:paddingBottom="3dp"
                android:paddingTop="3dp"
                android:text="@string/app_tab_name_4"
                android:textColor="@color/search_colorbg"
                android:textSize="12.0sp"
                android:textStyle="normal" />
        </RadioGroup>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_above="@+id/numbers_radio"
            android:layout_below="@id/gd_action_bar"
            android:orientation="vertical" >

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="1" >
            </FrameLayout>

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:visibility="gone" >
            </TabWidget>
        </LinearLayout>

        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/numbers_radio"
            android:background="@drawable/search_shadow_up" />

        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/gd_action_bar"
            android:background="@drawable/title_bar_shadow" />
    </RelativeLayout>

</TabHost>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值