0

Android ビューの下部にカスタム タブバーがあります。メインページのコンテンツは利用可能な高さ全体を占める必要があるため、メインページで「GONE」にしたいと思います。

しかし、visibility="gone" を設定しても、メインページをレンダリングするときにタブバーの 100dp の高さが考慮されているように思えます。これは、コンテンツ ビューが完全な高さではないためです。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" android:gravity="center_horizontal">

    <FrameLayout android:layout_width='fill_parent'
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:orientation="vertical" android:id="@+id/content">

   </FrameLayout>

   <fragment android:name="MainActivity$TabBarFragment"
    android:visibility="gone"
    android:id="@+id/tabbar"
    android:layout_weight="1"
    android:layout_width="fill_parent"
    android:layout_height="100dp"/>

ContentView をメインページで完全な高さにするにはどうすればよいですか?

4

1 に答える 1

0

自分で見つけました。

私は今使用しています:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" android:gravity="center_horizontal">

<FrameLayout android:layout_width='fill_parent'
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:orientation="vertical" android:id="@+id/content">

</FrameLayout>

<fragment android:name="MainActivity$TabBarFragment"
    android:id="@+id/tabbar"
    android:layout_weight="1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>

代わりに、TabBarFragment レイアウト ファイルはその高さを定義し、visibility=gone を定義します。それはうまくいきます。

于 2012-01-01T07:12:36.457 に答える