为什么这个布局的上半部分不显示?

时间:2012-08-10 07:45:18

标签: android android-layout

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

<?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>

1 个答案:

答案 0 :(得分: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将其放在标题下方和页脚上方