タブを使用する場合、FrameLayoutの上部境界線
-
11-10-2019 - |
質問
Androidアプリケーションでタブを使用する画面があります。 Tabwidgetと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-Indexを操作することにより、これを解決することができました。フレームレイアウトの上にタブをわずかに配置することができました。以下のコードを参照してください:
<?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の上部境界を削除しようとしました。やったよ。しかし、私はそれが上部の境界を削除する方法ではないと思います。とにかくfyi、
境界線に背景白でテキストビューを配置し、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>
所属していません StackOverflow