对齐屏幕下方片段 [英] Align fragment on bottom of screen

查看:104
本文介绍了对齐屏幕下方片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我有放在里面的片段部件的线性布局。我试图让片段显示在屏幕的底部。所以我想它固定在屏幕的底部总是在页面可能在未来的滚动。我怎样才能做到这一点?

Hi I have a linear layout with a fragment widget placed inside it. I'm trying get the fragment to show up on the bottom of the screen. The page may be scrollable in the future so I want it anchored on the bottom of the screen always. How can I achieve this?

推荐答案

您必须使用 RelativeLayout的。事情是这样的:

You must use RelativeLayout. Something like this:

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

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/bottom_fragment" >
    </ScrollView>

    <fragment
        android:id="@+id/bottom_fragment"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_alignParentBottom="true" >
    </fragment>

</RelativeLayout>

这篇关于对齐屏幕下方片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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