繁体   English   中英

在填满屏幕的ViewPager下,将LinearLayout与底部对齐

[英]Align LinearLayout to bottom, under ViewPager that fills screen

如何正确创建这样的布局?

在此处输入图片说明

我想在ViewPager(不在内部)下使用LinearLayout 2。

我知道没有什么方法可以存档,但是最好的方法是什么?

您必须为您的viewpager设置layout_weight。 您可以使用此xml复制粘贴。

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"></LinearLayout>

    <ViewPager
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"></LinearLayout>
</LinearLayout>

将所有控件放入RelativeLayout控件中

在此属性的ViewPager控件中使用此属性

android:layout_below="@+id/linearlayout1"
android:layout_above="@+id/linearlayout2"

LinearLayout 2上的android:layout_alignParentBottom="true"

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM