0

这是我的布局。问题是 PageViewer 内容是可见的,没有别的。如果我看到 PageViewer 消失了,我会看到它上面的所有内容。还尝试将根布局作为框架布局,但没有帮助。主要的是只有视图寻呼机是可见的。我想要的是包含数据的 2/3 ViewPager 内容,以及一些 1/3 的标题材料。我不想使用权重,因为上部的尺寸已经正确。我只想保证顶部和浏览器都正确显示。他们切换所有内容是网页浏览者的特征吗?还是不能将它们应用于另一个元素下方?

<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mHeaderHeader"
android:visibility="visible"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

<include
    android:id="@+id/myInclude"
    layout="@layout/myInclude_layout" />

<include
    android:id="@+id/myInclude2r"
    layout="@layout/myInclude2" />

<FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >
 </FrameLayout>

<include
    android:id="@+id/myInclude3"
    layout="@layout/myinclude3layout" />

<ImageView
    android:id="@+id/myImageView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    />

</LinearLayout>


<android.support.v4.view.ViewPager
android:id="@+id/myViewPager"
android:visibility="visible"
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
 />
   <include layout="@layout/myinclude4" />

 </LinearLayout>
4

1 回答 1

0

你可以尝试这样的事情:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent" >
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/mHeaderHeader"
        android:visibility="visible"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="true"
        android:orientation="vertical">

        <include
            android:id="@+id/myInclude"
            layout="@layout/myInclude_layout" />

        <include
            android:id="@+id/myInclude2r"
            layout="@layout/myInclude2" />

        <include
            android:id="@+id/myInclude3"
            layout="@layout/myinclude3layout" />

        <ImageView
            android:id="@+id/myImageView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            />

    </LinearLayout>

    <include layout="@layout/myinclude4"
        android:id="@+id/myinclude4" />

    <android.support.v4.view.ViewPager
        android:id="@+id/myViewPager"
        android:visibility="visible"
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"
        android:layout_alignBelow="@id/mHeaderHeader"
        android:layout_alignAbove="@id/myinclude4" />

 </RelativeLayout>

我想 ViewPager 占用了所有空间,所以我使用 RelativeLayout 将它放在页眉下方和页脚上方

于 2012-08-10T08:02:24.307 回答