无法将页脚与屏幕底部对齐? [英] Not Able To align Footer at bottom of screen?

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

问题描述

我无法在屏幕底部对齐页脚.我使用了RelativeLayout,其中<​​strong> android:layout_alignParentBottom ="true" ,但布局未显示在屏幕底部

I am not able to align the footer at the Bottom of the screen.I have used RelativeLayout within which android:layout_alignParentBottom="true" but the layout is not displayed at the bottom of the screen.

loan_collection_layout

  <?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="25dp"
            android:background="#156B7A"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginLeft="125dp"
                android:text="Branch Office : Dhankuta"
                android:textColor="#FFFFFF"
                android:textSize="10sp" />

            <View
                android:layout_width="1dp"
                android:layout_height="13dp"
                android:layout_gravity="center"
                android:layout_marginLeft="5dp"
                android:background="#FFFFFF" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginLeft="5dp"
                android:text="Tuesday -4 April,2017"
                android:textColor="#FFFFFF"
                android:textSize="10sp"


                />

        </LinearLayout>


        <!-- Loan collection  -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:layout_marginLeft="10dp"
            android:orientation="horizontal"
            android:weightSum="1">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:text="Loan Collection"
                android:textColor="#2493A7"
                android:textSize="15sp"
                android:textStyle="bold" />

            <ImageView
                android:layout_width="12dp"
                android:layout_height="12dp"
                android:layout_gravity="center"
                android:layout_marginLeft="120dp"
                android:layout_marginRight="2dp"
                android:src="@mipmap/filter" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="15dp"
                android:layout_gravity="center"
                android:text="Filter"
                android:textSize="12sp"
                android:textStyle="normal" />

            <View
                android:layout_width="1dp"
                android:layout_height="15dp"
                android:layout_gravity="center"
                android:layout_marginLeft="5dp"
                android:background="#98A6A9" />

            <ImageView
                android:layout_width="12dp"
                android:layout_height="12dp"
                android:layout_gravity="center"
                android:layout_marginLeft="10dp"
                android:layout_weight="0.01"
                android:src="@mipmap/search" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="15dp"
                android:layout_gravity="center"
                android:layout_marginLeft="5dp"
                android:text="Search"
                android:textSize="12sp"
                android:textStyle="normal" />


        </LinearLayout>


        <!-- Linear Layout for 2nd Linear Layout -->

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:orientation="horizontal">


            <!-- 2nd liner layout ist column  -->

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/border"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="12dp"
                    android:layout_gravity="center"
                    android:layout_marginTop="7dp"
                    android:src="@mipmap/center" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_gravity="center"
                    android:text="Center:005"
                    android:textSize="10sp" />


            </LinearLayout>

            <View
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="0.03"
                android:background="#FFFFFF" />


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:background="@drawable/border"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="12dp"
                    android:layout_gravity="center"
                    android:layout_marginTop="7dp"
                    android:src="@mipmap/group" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_gravity="center"
                    android:text="Group"
                    android:textSize="10sp" />


            </LinearLayout>


            <View
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="0.03"
                android:background="#FFFFFF" />

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:background="@drawable/border"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="12dp"
                    android:layout_gravity="center"
                    android:layout_marginTop="7dp"
                    android:src="@mipmap/loan_type" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_gravity="center"
                    android:text="Loan Type"
                    android:textSize="10sp" />


            </LinearLayout>

            <View
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="0.03"
                android:background="#FFFFFF" />

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:background="@drawable/border"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="12dp"
                    android:layout_gravity="center"
                    android:layout_marginTop="7dp"
                    android:src="@mipmap/date" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_gravity="center"
                    android:text="Date:"
                    android:textSize="10sp" />


            </LinearLayout>

            <View
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="0.03"
                android:background="#FFFFFF" />

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:background="@drawable/border"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="12dp"
                    android:layout_gravity="center"
                    android:layout_marginTop="7dp"
                    android:src="@mipmap/valuedate" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_gravity="center"
                    android:text="value date:"
                    android:textSize="10sp" />


            </LinearLayout>

        </LinearLayout>   <!-- Linear Layout 2nd ends Here -->


        <!-- Linear Layout for Group code starts here-->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp"
            android:orientation="horizontal">

            <CheckBox
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_gravity="center"
                android:layout_marginRight="5dp"
                android:buttonTint="#000000" />


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/border_loan_collection">

                <TextView


                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="Group Code"
                    android:textColor="#333333"
                    android:textSize="12sp"
                    android:textStyle="bold" />

            </LinearLayout>


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/border_loan_collection">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="Member No."
                    android:textColor="#333333"
                    android:textSize="12sp"
                    android:textStyle="bold" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/border_loan_collection">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="Member Name"
                    android:textColor="#333333"
                    android:textSize="12sp"
                    android:textStyle="bold" />

            </LinearLayout>


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/border_loan_collection">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="Remain Price"
                    android:textColor="#333333"
                    android:textSize="12sp"
                    android:textStyle="bold" />

            </LinearLayout>


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/border_loan_collection">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="Total"
                    android:textColor="#333333"
                    android:textSize="12sp"
                    android:textStyle="bold" />

            </LinearLayout>


        </LinearLayout>

        <!-- 3rd layout starts here -->

        <!-- After third layout you have yo add listView in here and listitem should be populated through the JSON Data -->


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:orientation="horizontal">

            <CheckBox
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_gravity="center"
                android:layout_marginRight="5dp"
                android:buttonTint="#333333"
                android:checked="true" />


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="#F3F3F3">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="001"
                    android:textSize="12sp"
                    android:textStyle="normal" />

            </LinearLayout>


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="#F3F3F3">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text=" 001"
                    android:textSize="12sp"
                    android:textStyle="normal" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="#F3F3F3">

                <TextView
                    android:id="@+id/textView"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="Bimala Rai"
                    android:textSize="12sp"
                    android:textStyle="normal" />

            </LinearLayout>


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="#F3F3F3">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="0.00"
                    android:textSize="12sp"
                    android:textStyle="normal" />

            </LinearLayout>


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="#F3F3F3">

                <TextView

                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="0.00"
                    android:textSize="12sp"
                    android:textStyle="normal" />

            </LinearLayout>


        </LinearLayout><!-- 3rd layout ends here-->


        <!-- Linear Layout 4th starts here-->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"

            android:orientation="horizontal">

            <CheckBox
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_gravity="center"
                android:layout_marginRight="5dp"
                android:buttonTint="#333333" />


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/border_loan_collection">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="001"
                    android:textColor="#333333"
                    android:textSize="12sp"
                    android:textStyle="normal" />

            </LinearLayout>


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/border_loan_collection">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="001"
                    android:textColor="#333333"
                    android:textSize="12sp"
                    android:textStyle="normal" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/border_loan_collection">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="Uranus"
                    android:textColor="#333333"
                    android:textSize="12sp"
                    android:textStyle="normal" />

            </LinearLayout>


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/border_loan_collection">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="0.00"
                    android:textColor="#333333"
                    android:textSize="12sp"
                    android:textStyle="normal" />

            </LinearLayout>


            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/border_loan_collection">

                <TextView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="0.00"
                    android:textColor="#333333"
                    android:textSize="12sp"
                    android:textStyle="normal" />

            </LinearLayout>


        </LinearLayout>  <!-- 4th linear layout ends here -->




        <!-- Total Bottom Layout starts herel -->

        <!-- Footer aligned to bottom -->

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:layout_alignParentBottom="true"
            android:text="Footer"
            android:textColor="#000000"
            android:textSize="20sp" />



    </LinearLayout>

</RelativeLayout>

页脚如何显示在屏幕底部?

How can footer be displayed at bottom of screen??

推荐答案

您的主视图是LinearLayout,它无法按您尝试的方式工作.

You main view is LinearLayout which does not works the way you are trying it to.

要获得所需的结果,您需要将主版面设置为相对版面,然后将页脚下对齐设置为true.

For obtaining your desired result you need your main Layout to be Relative layout and then set align bottom true to your footer.

例如:-

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

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <!-- place all your view inside this layout-->

    </LinearLayout>

       <!--place your footer here with align bottom property set to true-->

         <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="5dp"
            android:layout_alignParentBottom="true"
            android:text="Footer"
            android:textColor="#000000"
            android:textSize="20sp" />
</RelativeLayout/>

此代码段应该可以帮助您.

This snippet should get you going.

这篇关于无法将页脚与屏幕底部对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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