简体   繁体   English

相对布局重叠

[英]Overlap in relative layout

I have a Layout problem. 我有一个布局问题。 I have tried for hours to get it right but I cant figure it out. 我已经尝试了几个小时以使其正确,但我无法弄清楚。

It should be simple really. 真的应该很简单。

I have a layout that looks like this: Fixed on the Screen are a header and a footer, in between these there is a scrollale view that displays some information and a button. 我有一个看起来像这样的布局:屏幕上固定有一个页眉和一个页脚,在它们之间有一个滚动视图,显示一些信息和一个按钮。

All I want that header, button and footer is fixed and the infomration fill the rest of the screen as good as possible. 我想要的所有标题,按钮和页脚都是固定的,并且信息填充尽可能完整地填充屏幕的其余部分。

The solution I have at moment almost works, the problem with it is that the information and the button overlap (the button is on top). 我现在所拥有的解决方案几乎可以用,它的问题是信息和按钮重叠(按钮在顶部)。 The information only starts to scroll if it would overlap with the footer. 仅当信息与页脚重叠时,信息才开始滚动。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/wrap_main" >

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

    <RelativeLayout
        android:id="@+id/body"
        style="@style/wrap_body_with_footer_style"
        android:layout_below="@id/in_header" >

       <!--  This is a scrollable view --> 
       <include  android:id="@+id/job_description"
                 layout="@layout/job_description" />

        <Button android:id="@+id/btn_job_details_pick_up_submit"
                style="@style/btn_confirmation_style"
                android:text="@string/btn_job_details_pick_up_submit"
                android:layout_alignParentBottom="true" />

      </RelativeLayout>

   <include layout="@layout/footer_krest_home_phone" />

</RelativeLayout>

So JobDiscription and Button overlap. 因此JobDiscription和Button重叠。

Any Ideas? 有任何想法吗?

Thanks everybody. 谢谢大家。

Edit: Somebody mention LinearLayouts in the comments. 编辑:有人在评论中提到LinearLayouts。 I did try with LinearLayouts but I had the effect that the information, instead of contracting, pushed down the button so it was not fully visable anymore. 我确实使用LinearLayouts进行了尝试,但是我的效果是该信息(而不是收缩)按下按钮,因此不再完全可见。 If you have a solution to stop this pusing down effect, I'll happly change to LinearLayouts. 如果您有解决方案来停止这种拖延效果,那么我将更改为LinearLayouts。

As already discussed in the comments, I would also suggest positioning job_description above btn_job_details_pick_up_submit with android:layout_above="@id/btn_job_details_pick_up_submit" . 正如评论中已经讨论的那样,我还建议使用android:layout_above="@id/btn_job_details_pick_up_submit"将job_description放在btn_job_details_pick_up_submit上方。

Above does not mean on top of something, it aligns the bottom of the view with the top of another one. 上面的意思并不意味着某物的顶部,它使视图的底部与另一视图的顶部对齐。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 工具栏重叠的相对布局 - Toolbar overlap relative layout 防止TextView和ImageView在相对布局中重叠 - Preventing TextView and ImageView Overlap In Relative Layout 防止TextView在相对布局中与下一个元素重叠 - Prevent TextView overlap next element in Relative layout 如何在android中避免相对布局中的重叠视图? - How to avoid overlap view in relative layout in android? 如何在相对布局中部分重叠视图 - How to partially overlap views within a relative layout 如何确保视图放置在相对布局中时不重叠 - How to make sure views dont overlap when placed in a Relative Layout 尝试使用相对布局(Android)以编程方式定位时控件重叠 - Controls overlap when trying to position programmatically using relative layout (Android) 相对布局,对齐父视图和右视图的中心,没有重叠 - Relative Layout, align center of parent and right of view with no overlap 将相对布局的透明前景重叠,以使文本视图在相对布局内部变为灰色透明 - Overlap a transparent foreground of a Relative layout to make text views color gray transparent inside Relative layout Android:相对布局的子元素彼此重叠,或者只有最后一个或第一个可见 - Android : Childs of a relative layout either overlap each other or only the last or the first one is visible
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM