1

第一张图片: 在此处输入图像描述

第二张图片: 在此处输入图像描述

第一个 XML:

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:padding="10dp" >

    <EditText
        android:id="@+id/text"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="99.81"
        android:ems="10"
        android:hint="@string/search_hint" />

    <ImageButton
        android:id="@+id/add"
        android:layout_width="35dp"
        android:layout_height="match_parent"
        android:layout_weight="4.47"
        android:background="@drawable/search_button"
        android:contentDescription="@string/desc"
        android:src="@drawable/ic_menu_search_bar" />
</LinearLayout>

<View
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:background="#dddddd" />

<FrameLayout
    android:id="@+id/player_frag_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</FrameLayout>

第二个 XML:

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:padding="10dp" >

    <Button
        android:id="@+id/list_view_upcoming"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="@string/label_upcoming"
        android:layout_weight="1" />

    <Button
        android:id="@+id/list_view_completed"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/label_completed" />
</LinearLayout>

<View
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:background="#dddddd" />

<FrameLayout
    android:id="@+id/fragment_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</FrameLayout>

请问谁能帮我改变我的第一次加载,使它像第二次加载一样中间?

4

2 回答 2

2

我已经解决了。

我将第二个 xml 的布局高度更改为:

 <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:padding="10dp" >

    <Button
        android:id="@+id/list_view_upcoming"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="@string/label_upcoming"
        android:layout_weight="1" />

    <Button
        android:id="@+id/list_view_completed"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/label_completed" />

</LinearLayout>

<View
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:background="#dddddd" />

<FrameLayout
    android:id="@+id/fragment_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</FrameLayout>
于 2012-12-19T07:08:22.223 回答
2

尝试在 Manifest.xml 中使用以下活动属性

android:windowSoftInputMode="adjustPan" or "adjustResize"
于 2012-12-19T07:00:31.947 回答