尽管在“线性布局”中滚动,如何修复底部的按钮

时间:2017-08-31 07:26:22

标签: android xml

我是android的新手,有线性布局并在其中滚动。即使滚动发生,我也希望我的Button固定在底部,不知道该怎么做。下面是我的代码,按钮是最后一个。有人可以帮忙吗我试过" android_gravity"和" layout_bottom = true"我在stackoverflow中读到的几个答案,当我使用LinearLayout时,我应该使用它们

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:card_view="http://schemas.android.com/tools"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorWhite"
    android:orientation="vertical"
    tools:ignore="ContentDescription|MissingPrefix">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/action_bar_height"
        android:background="@android:color/transparent"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

        <RelativeLayout
            android:id="@+id/toolbar_layout"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

            <TextView
                android:id="@+id/title_text"            
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_centerVertical="true"
                android:textStyle="bold"
                android:gravity="center"
                android:text="@string/registration_string"
                android:textColor="@color/eula_body_text_color"
                android:textSize="19sp" />
        </RelativeLayout>
    </android.support.v7.widget.Toolbar>

    <TextView
        android:id="@+id/tool_border"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_below="@id/toolbar"
        android:background="@color/tool_border_color" />

    <ScrollView
        android:id="@+id/scrollView_layout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorWhite"
        android:fitsSystemWindows="true"
        android:visibility="visible">

        <LinearLayout
            android:id="@+id/registration_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/_20sdp"
            android:background="@color/colorWhite"
            android:orientation="vertical"
            android:visibility="visible">

            <View
                android:id="@+id/profileFocus"
                android:layout_width="1dp"
                android:layout_height="1dp"
                android:focusable="true"
                android:focusableInTouchMode="true" />



            <LinearLayout
                android:id="@+id/addPictureImageLayout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center_horizontal"
                >

                <ImageView
                    android:id="@+id/addPictureImage"
                    android:layout_width="140dip"
                    android:layout_height="140dip"
                    android:layout_marginBottom="22.5dp"
                    android:background="@drawable/uploadidphoto"
                    android:visibility="visible" />

            </LinearLayout>

            <TextView
                android:id="@+id/imagephotorequired"

                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginBottom="@dimen/_11sdp"
                android:text="@string/image_photo_required"
                android:textColor="#ffe7181c"
                android:visibility="invisible"
                android:textSize="@dimen/_9sdp" />

            <LinearLayout
                android:id="@+id/card_view2"
                android:layout_width="@dimen/_110sdp"
                android:layout_height="@dimen/_110sdp"
                android:layout_below="@+id/profile_layout"
                android:layout_gravity="center"
                android:layout_marginBottom="@dimen/_32sdp"
                android:layout_marginTop="@dimen/_25sdp"
                android:visibility="gone"
                card_view:cardCornerRadius="@dimen/_2sdp">

                <com.honeywell.hbs.visitormanagement.utils.CircleImage
                    android:id="@+id/profileImage"
                    android:layout_width="@dimen/_87sdp"
                    android:layout_height="@dimen/_87sdp"
                    android:layout_gravity="center"
                    android:foregroundGravity="center_vertical"
                    android:scaleType="fitCenter" />


            </LinearLayout>

            <!--  <TextView
                  android:id="@+id/vectorText"

                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_gravity="left"
                  android:layout_marginBottom="@dimen/_20sdp"
                  android:gravity="left"
                  android:text="@string/registrationDetails"
                  android:textColor="@color/gray606060"
                  android:textSize="@dimen/_15sdp" />
  -->

            <TextView
                android:id="@+id/nameText"

                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/_11sdp"
                android:text="@string/first_name"
                android:textColor="@color/blackText"
                android:textSize="@dimen/_12sdp" />



            <LinearLayout
                android:id="@+id/addIdProofPictureImageLayout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="10dip"
                android:orientation="vertical">

                <ImageView
                    android:id="@+id/id_proof_document"
                    android:layout_width="140dip"
                    android:layout_height="140dip"
                    android:layout_gravity="center"
                    android:background="@drawable/uploadidproof"
                    android:visibility="visible" />

            </LinearLayout>


            <TextView
                android:id="@+id/id_proof_number_tv"

                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/_10sdp"
                android:layout_marginTop="10dip"
                android:text="@string/id_proof_number"
                android:textColor="@color/blackText"
                android:textSize="@dimen/_12sdp" />

            <EditText
                android:id="@+id/id_proof_number"
                android:layout_width="fill_parent"
                android:layout_height="@dimen/_34sdp"
                android:layout_marginTop="1dip"
                android:maxLength="4"

                android:background="@drawable/edit_text_border"
                android:drawableRight="@drawable/asterix"
                android:paddingEnd="@dimen/_5sdp"
                android:paddingRight="@dimen/_5sdp"
                android:paddingStart="@dimen/_5sdp"
                android:textColor="@color/black"
                android:singleLine="true" />

            <TextView
                android:id="@+id/proofnumberrequired"

                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/_11sdp"
                android:text="@string/proofnumber_required"
                android:textColor="#ffe7181c"
                android:visibility="invisible"
                android:textSize="@dimen/_9sdp" />

            <TextView
                android:id="@+id/id_proof_type_tv"

                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/_10sdp"
                android:text="@string/id_proof_type"
                android:textColor="@color/blackText"
                android:textSize="@dimen/_12sdp" />

            <EditText
                android:id="@+id/id_proof_type"
                android:layout_width="fill_parent"
                android:layout_height="@dimen/_34sdp"
                android:layout_marginTop="1dip"

                android:background="@drawable/edit_text_border"
                android:drawableRight="@drawable/asterix"
                android:paddingEnd="@dimen/_5sdp"
                android:paddingRight="@dimen/_5sdp"
                android:paddingStart="@dimen/_5sdp"
                android:textColor="@color/black"
                android:singleLine="true" />

            <TextView
                android:id="@+id/prooftyperequired"

                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/_11sdp"
                android:text="@string/prooftype_required"
                android:textColor="#ffe7181c"
                android:visibility="invisible"
                android:textSize="@dimen/_9sdp" />

            <!--<Spinner
                android:id="@+id/id_proof_spinner"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:layout_below="@+id/idProofcard_view"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="@dimen/_10sdp"
                android:entries="@array/id_proof_type"
                android:popupBackground="#FFF"
                android:spinnerMode="dropdown" />

            <View
                android:layout_width="match_parent"
                android:layout_below="@+id/id_proof_spinner"
                android:layout_height="1dp"
                android:layout_marginBottom="@dimen/_24sdp"
                android:background="#ffa0a0a0" />-->


            <Button
                android:id="@+id/btn_login"
                style="?android:attr/borderlessButtonStyle"

                android:layout_marginTop="15dip"
                android:layout_width="fill_parent"
                android:layout_height="@dimen/_34sdp"
                android:layout_marginBottom="@dimen/_24sdp"
                android:background="@drawable/button_state"
                android:gravity="center"
                android:text="@string/confirm"
                android:textColor="@color/colorWhite"
                android:textSize="@dimen/_16sdp" />

        </LinearLayout>

    </ScrollView>

    <ProgressBar
        android:id="@+id/progressbar"
        android:visibility="invisible"
        android:layout_centerInParent="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>

0 个答案:

没有答案