0

3つのレイアウトがあります。最初のレイアウトはプログラムでコンテンツを追加し、2番目のレイアウトはプログラムでコンテンツを追加して下部に配置し、3番目のレイアウトはフラグメントを配置します。40dp高さをフラグメントに設定すると、下部のレイアウトに問題が表示されます。しかしwrap_content、フラグメントに設定すると表示されません...

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <RelativeLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true" />

    <RelativeLayout
        android:id="@+id/acts"
        android:layout_width="match_parent"
        //android:layout_height="wrap_content" <-id/frame not show
        android:layout_height="40dp" <-id/frame show
        android:layout_alignParentBottom="true" />

    <FrameLayout
        android:id="@+id/frame"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/tabs"
        android:layout_above="@id/acts" />

</RelativeLayout>
4

3 に答える 3

0

I have fix it, just add the acts layout to bottom of fragment and now its work fine. Tanks for your help.

于 2012-12-06T19:13:18.767 に答える
0

このように設定します

android:layout_above="@+id/frame"

それがお役に立てば幸いです。

于 2012-12-06T17:47:30.557 に答える
0

これで、背景色を設定し、最小の高さを設定して、何が起こっているかを示します。「@ + id / acts」レイアウトの最小の高さを削除して、これを試してください。フレームが空にないことがわかります:)

アップデート

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

    <RelativeLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="50dp"
        android:background="#f00"
        android:layout_alignParentTop="true" />

    <FrameLayout
        android:id="@+id/frame"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="50dp"
        android:background="#0f0"
        android:layout_above="@+id/acts"
        android:layout_below="@+id/tabs" />

    <RelativeLayout
        android:id="@+id/acts"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="50dp"
        android:background="#00f"
        android:layout_alignParentBottom="true" />

</RelativeLayout>
于 2012-12-06T17:58:18.117 に答える