Вопрос

У меня есть экран, который использует вкладки в моем приложении Android. Существует линия (как граница), которая показывает между Tabwidget и Framelayout. Я хочу избавиться от этой линии, но, кажется, не могу найти, что это такое. Я определил, что он является частью Framelayout, установив его визит. Пожалуйста, обратитесь к коду ниже:

<?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"        
    android:background="#fb8c10"
    >

    <ImageView
    android:id="@+id/img_confirm_header"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/confirm_header"                 
    />

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:layout_marginBottom="0dip"
        android:background="#fb8c10"                              
        android:tabStripEnabled="false"                         
        />

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"            
        android:background="@drawable/tab_bg"                                                
         />
</LinearLayout>
</TabHost>

Это ссылка на текущую макет и то, что я пытаюсь сделатьhttp://img441.imageshack.us/g/screenshot20110116at513.png/

Оранжевый макет - это мое приложение, а серый - это то, что я пытаюсь сделать.

Обратите внимание, как на сером скриншоте вкладка входит в кадр.

Приносим извинения за ссылки, я пока не могу публиковать изображения: P

Спасибо!

Это было полезно?

Решение

Мне удалось решить это, манипулируя z-индексом, используя относительный макет. Я смог немного поместить вкладки над макетом кадра. См. Код ниже:

<?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"        
        android:background="#fb8c10"
        >
        <ImageView
        android:id="@+id/img_confirm_header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/tab_header"

        />
        <RelativeLayout
        android:id="@+id/widget77"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@android:color/transparent"
        >                    
            <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"            
            android:background="@android:color/transparent"                             
            android:layout_marginTop="33dip"                                                   
             />
             <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"            
            android:background="#fb8c10"                              
            android:tabStripEnabled="true"  
            android:layout_above="@android:id/tabcontent"
            android:layout_marginBottom="40dip"                                            
            />
        </RelativeLayout>
    </LinearLayout>
</TabHost>

Другие советы

Только сейчас я наткнулся на эту проблему. Тем не менее, я также попытался снять верхнюю границу Framelayout. Я это сделал. Но я не думаю, что это способ удалить верхнюю границу. В любом случае, к вашему сведению,

Просто поместите TextView с фоновым белым на границе и используйте AbsoluteLayout.

Например:

<AbsoluteLayout>

<TabHost 
    android:layout_x="0dip"
    android:layout_y="5dip" ...>

    <AbsoluteLayout android:padding="5dip" android:background="#ffffff">
        <TabWidget/>
        <FrameLayout ....
        android:layout_x="0dip" android:layout_y="65dip" />
    </AbsoluteLayout>

</TabHost>

  <TextView 
    android:layout_width="fill_parent" android:layout_height="25dip" 
    android:layout_x="0dip" android:layout_y="65dip" 
    android:background="#ffffff"/>

</AbsoluteLayout>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top