为什么这样布局的上半部分不显示? [英] Why upper part of this layout does not display?

查看:141
本文介绍了为什么这样布局的上半部分不显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的布局。的问题是,无论是PageViewer内容是可见的,并没有别的。如果我看到PageViewer来走了,比我看到的一切都在它上面。也试过根布局,框架布局,但它并不能帮助。最主要的是只有视图寻呼机是可见的。我要的是2/3 ViewPager内容包含数据,以上就是1/3一些头的材料。我不想使用权重的上半部分已经是正确的大小。我只是想确保顶部和pageviewer正常显示。是不是因为他们的一切切换的pageviewers一个特点呢?或者他们不低于另一个元素被应用?

 <?XML版本=1.0编码=UTF-8&GT?;
 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:方向=垂直
机器人:layout_height =match_parent>
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:ID =@ + ID / mHeaderHeader
机器人:知名度=看得见
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:方向=垂直><包括
    机器人:ID =@ + ID / myInclude
    布局=@布局/ myInclude_layout/><包括
    机器人:ID =@ + ID / myInclude2r
    布局=@布局/ myInclude2/><的FrameLayout
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT>
 < /&的FrameLayout GT;<包括
    机器人:ID =@ + ID / myInclude3
    布局=@布局/ myinclude3layout/>< ImageView的
    机器人:ID =@ + ID / myImageView
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    />< / LinearLayout中>
< android.support.v4.view.ViewPager
机器人:ID =@ + ID / myViewPager
机器人:知名度=看得见
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
 />
   <包括布局=@布局/ myinclude4/> < / LinearLayout中>


解决方案

您可以尝试这样的事情:

 <?XML版本=1.0编码=UTF-8&GT?;
<的RelativeLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =match_parent
    机器人:方向=垂直
    机器人:layout_height =match_parent>
    < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
        机器人:ID =@ + ID / mHeaderHeader
        机器人:知名度=看得见
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:layout_alignParentTop =真
        机器人:方向=垂直>        <包括
            机器人:ID =@ + ID / myInclude
            布局=@布局/ myInclude_layout/>        <包括
            机器人:ID =@ + ID / myInclude2r
            布局=@布局/ myInclude2/>        <包括
            机器人:ID =@ + ID / myInclude3
            布局=@布局/ myinclude3layout/>        < ImageView的
            机器人:ID =@ + ID / myImageView
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            />    < / LinearLayout中>    <包括布局=@布局/ myinclude4
        机器人:ID =@ + ID / myinclude4/>    < android.support.v4.view.ViewPager
        机器人:ID =@ + ID / myViewPager
        机器人:知名度=看得见
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_alignBelow =@ ID / mHeaderHeader
        机器人:layout_alignAbove =@ ID / myinclude4/> < / RelativeLayout的>

我想这Vie​​wPager通吃的空间,所以我使用的RelativeLayout把它放在页眉下方及以上页脚

Here is my layout. The problem is that either the PageViewer contents are visible and nothing else. If I see PageViewer to gone than I see everything above it. Also tried root layout as frame layout but it does not help. Main thing is only the view pager is visible. What I want is 2/3 ViewPager contents which contains data, and above some header material that is 1/3. I don't want to use weights as the upper part is already sized correctly. I just want to guarantee that both the top and pageviewer display properly. Is it a characteristic of pageviewers that they switch everything? or can they not be applied below another element?

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

解决方案

You can try something like this:

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

I suppose that ViewPager takes all space, so I placed it below header and above footer using RelativeLayout

这篇关于为什么这样布局的上半部分不显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆