Как сделать вкладки в виде вкладок прозрачными - PullRequest
1 голос
/ 23 сентября 2011

Как мне сделать представление вкладок, чтобы вкладки были немного прозрачными, чтобы вы могли видеть содержимое Listview, размещенного в представлении tab?

1 Ответ

1 голос
/ 23 сентября 2011

Вы можете скрыть виджет вкладки.И используйте кнопки

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@android:id/tabhost" 
     android:layout_width="fill_parent" android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" 
    android:layout_height="fill_parent">
    <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:id="@+id/header">
        <TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:text="woopra" android:textColor="#ffffff" android:textSize="36sp"
            android:textStyle="bold"/>
    </LinearLayout>       
    <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
        <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" 
            android:layout_height="wrap_content" android:visibility="gone"/>            
        <LinearLayout android:layout_width="fill_parent" android:layout_height="64dip">
            <Button android:layout_height="fill_parent" android:layout_width="0dip" 
                android:layout_weight="1.0" android:id="@+id/dashboard_tab" 
                android:onClick="tabHandler" android:text="Dashboard"/>
            <Button android:layout_height="fill_parent" android:layout_width="0dip" 
                android:layout_weight="1.0" android:id="@+id/visitors_tab" 
                android:onClick="tabHandler" android:text="Vistors"/>
            <Button android:layout_height="fill_parent" android:layout_width="0dip" 
                android:layout_weight="1.0" android:id="@+id/chat_tab" android:onClick="tabHandler"
                android:text="Chat"/>
            <Button android:layout_height="fill_parent" android:layout_width="0dip" 
                android:layout_weight="1.0" android:id="@+id/reports_tab" 
                android:onClick="tabHandler" android:text="Reports"/>
        </LinearLayout> 
    </FrameLayout>
    <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="0dip"
                 android:layout_weight="1.0"/>
</LinearLayout>

Здесь я использовал 4 кнопки вместо вкладки.А в нажатии кнопки я использую что-то вроде tabHost.setCurrentTab (1);

Настройка альфа на кнопки должна работать.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...