Help with xml, Android Studio

0

My App consists of a Activity where the Fragment are loaded.

In this case to load is fragment_automotor , it performs a search based on a patent, returns the data of the owner and in a RecyclerView classifies the debt today.

Said fragment has a LinearLayout where when clicking on a type of debt, a fragment (detail_fragment) is dynamically loaded with the detail thereof (this is done in this way because in addition to automotive can be consult other rates and reuse the code of this fragment).

When selecting one or more vouchers, a button appears indicating the amount to pay and when clicking, it redirects the payment.

The problem is that I pretend that this button is located at the end of the screen and I can not achieve it, I am superimposed on the vouchers and with white space underneath, maybe someone sees an error that I do not. I leave the xml of the fragment involved and an image for a better understanding of the problem

fragment_automotor

<android.support.design.widget.AppBarLayout
    android:id="@+id/app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.design.widget.CollapsingToolbarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <android.support.v7.widget.CardView 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/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginHorizontal="10dp"
            android:layout_marginTop="10dp"
            android:background="#ffffff"
            android:clipChildren="false"
            android:clipToPadding="false"
            android:elevation="8dp"
            app:cardCornerRadius="@dimen/radius"
            card_view:cardElevation="@dimen/card_elevation"
            card_view:cardPreventCornerOverlap="false">

            <LinearLayout
                android:id="@+id/layout_busqueda"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="25dp"
                android:orientation="horizontal"
                android:padding="10dp">

                <EditText
                    android:id="@+id/etBuscarPatente"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_weight="0.6"
                    android:gravity="center"
                    android:hint="Patente"
                    android:textColorHint="@color/colorGreyDark"
                    android:maxLength="10"
                    android:textColor="@color/colorPrimaryText"
                    android:textSize="15dp" />

                <Button
                    android:id="@+id/btnBuscar"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical"
                    android:layout_weight="0.4"
                    android:drawableLeft="@drawable/ic_search"
                    android:drawablePadding="5dp"
                    android:text="@string/search"
                    android:theme="@style/RaisedButton" />
            </LinearLayout>
        </android.support.v7.widget.CardView>

    </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

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

        <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
            android:id="@+id/cardDatos"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginHorizontal="10dp"
            android:background="#ffffff"
            android:clipChildren="false"
            android:clipToPadding="false"
            android:divider="@android:color/transparent"
            android:dividerHeight="0.0px"
            android:elevation="8dp"
            app:cardCornerRadius="@dimen/radius"
            app:cardUseCompatPadding="true"
            card_view:cardElevation="@dimen/card_elevation"
            card_view:cardPreventCornerOverlap="false"
            android:visibility="gone">

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

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.3"
                        android:padding="3dip"
                        android:text="Cuenta N°"
                        android:textStyle="italic" />

                    <TextView
                        android:id="@+id/txtIdCuenta"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.7"
                        android:padding="3dip"
                        android:textStyle="italic" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.3"
                        android:padding="3dip"
                        android:text="Titular"
                        android:textStyle="italic" />

                    <TextView
                        android:id="@+id/txtTitular"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.7"
                        android:padding="3dip"
                        android:textStyle="italic" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.3"
                        android:padding="3dip"
                        android:text="Vehículo"
                        android:textStyle="italic" />

                    <TextView
                        android:id="@+id/txtDescripcion"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.7"
                        android:padding="3dip"
                        android:textStyle="italic" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.4"
                        android:padding="3dip"
                        android:text="Modelo"
                        android:textStyle="italic" />

                    <TextView
                        android:id="@+id/txtModelo"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.6"
                        android:padding="3dip"
                        android:textStyle="italic" />

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.4"
                        android:padding="3dip"
                        android:text="Patente"
                        android:textStyle="italic" />

                    <TextView
                        android:id="@+id/txtPatente"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="0.6"
                        android:padding="3dip"
                        android:textStyle="italic" />
                </LinearLayout>

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/rvComp1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:scrollbars="horizontal" />
            </LinearLayout>
        </android.support.v7.widget.CardView>
        <LinearLayout
            android:id="@+id/fragment_contenedor"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
        </LinearLayout>
    </LinearLayout>

</android.support.v4.widget.NestedScrollView>

MainActivity

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBackground">
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <include
            android:id="@+id/my_toolbar"
            layout="@layout/toolbar" />
        <FrameLayout
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        </FrameLayout>
    </LinearLayout>
    <android.support.design.widget.NavigationView
        android:id="@+id/navview"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/header_navigation_drawer"
        app:menu="@menu/nav_options"
        android:fitsSystemWindows="true"/>
</android.support.v4.widget.DrawerLayout>
</FrameLayout>

detail_fragment

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

    <TextView
        android:id="@+id/txtTipoDeudaComprobante"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:gravity="center"
        android:padding="3dip"
        android:textSize="18dp"
        android:layout_marginBottom="5dp"
        android:visibility="gone"/>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rvCompxTipo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical"/>
</LinearLayout>

<Button
    android:id="@+id/btnPagar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:background="@color/colorPrimary"
    android:drawableRight="@drawable/ic_chevron_right"
    android:padding="5dp"
    android:drawablePadding="10dp"
    android:visibility="gone"
    android:textColor="@color/colorWhite"
    android:textStyle="bold|italic" />

    
asked by DavidC 17.04.2018 в 13:31
source

1 answer

0

I suggest you add the property android:layout_below="@+id/rvCompxTipo" to ensure that the button is always positioned under RecyclerView :

         <Button
                android:id="@+id/btnPagar"
                android:layout_below="@+id/rvCompxTipo"

                ...
                ...
    
answered by 18.04.2018 в 00:01