我有一个在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的顶部边框。我做的。但是我认为这不是删除顶端边框的一种方式。无论如何

只需将带有背景白色的文本视图放在边框上,然后使用“绝对”。

例如:

<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