Вид, выровненный по родительскому низу, скрывается, включая относительную компоновку внутри компоновки координатора. - PullRequest
0 голосов
/ 27 августа 2018

Мой макет координатора

<?xml version="1.0" encoding="utf-8"?>
<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.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:elevation="0dp">

        <android.support.v7.widget.Toolbar
            android:id="@+id/Toolbar"
            android:layout_width="match_parent"
            android:layout_height="?actionBarSize"
            android:background="@drawable/bg_horizon_gradient"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            app:layout_scrollFlags="scroll|enterAlways|snap"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

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

    <FrameLayout
        android:id="@+id/view_stub"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>

<android.support.design.widget.NavigationView
    android:id="@+id/Navigation_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:headerLayout="@layout/navigation_header"
    app:itemTextColor="@android:color/holo_red_dark"
    app:menu="@menu/nav_drawer_menu" />

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

Я включаю относительный макет в макет кадра .У меня есть расположение кнопок ( Линейное расположение ) в относительном расположении, которое выровнено по низу.но расположение кнопок вообще не видно.расположение кнопок отображается, когда я использую линейное расположение вместо расположение координаторов , но я не могу получить функцию скрытия панели инструментов в этом. пожалуйста, помогите мне.Заранее спасибо.

Моя относительная раскладка

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
tools:context=".ProductDetailPage">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#fff"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/productImage_field"
        android:layout_width="match_parent"
        android:layout_height="@dimen/_200sdp"
        android:layout_marginTop="@dimen/_5sdp"
        app:srcCompat="@mipmap/ic_launcher" />

    <View
        android:layout_width="match_parent"
        android:layout_height="@dimen/_1sdp"
        android:layout_marginBottom="@dimen/_10sdp"
        android:background="?attr/colorButtonNormal" />

    <android.support.v7.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/_5sdp"
        android:layout_marginLeft="@dimen/_15sdp"
        app:cardCornerRadius="@dimen/_3sdp"
        app:cardElevation="@dimen/_5sdp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@android:color/holo_orange_dark"
            android:paddingBottom="@dimen/_4sdp"
            android:paddingLeft="@dimen/_5sdp"
            android:paddingRight="@dimen/_5sdp"
            android:paddingTop="@dimen/_4sdp"
            android:text="20% OFF"
            android:textColor="#fff"
            android:textSize="@dimen/_12ssp" />
    </android.support.v7.widget.CardView>

    <TextView
        android:id="@+id/productCategory_field"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/_3sdp"
        android:layout_marginLeft="@dimen/_15sdp"
        android:text="General Vegetables"
        android:textSize="@dimen/_12ssp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/productName_field"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/_3sdp"
        android:layout_marginLeft="@dimen/_15sdp"
        android:text="Onions"
        android:textColor="#000"
        android:textSize="@dimen/_14ssp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/productSp_field"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/_3sdp"
        android:layout_marginLeft="@dimen/_15sdp"
        android:text="MRP: Rs.40/-"
        android:textSize="@dimen/_12ssp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/productPrice_field"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/_3sdp"
        android:layout_marginLeft="@dimen/_15sdp"
        android:text="FC's MRP: Rs.38/-"
        android:textColor="#000"
        android:textSize="@dimen/_15ssp"
        android:textStyle="bold" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/_3sdp"
        android:layout_marginLeft="@dimen/_15sdp"
        android:text="Quantity"
        android:textColor="@color/colorPrimary"
        android:textSize="@dimen/_14ssp"
        android:textStyle="bold" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/_3sdp"
        android:layout_marginLeft="@dimen/_15sdp"
        android:layout_marginRight="@dimen/_15sdp">

        <TextView
            android:id="@+id/quantity_field"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="1"
            android:textSize="@dimen/_18ssp" />

        <TextView
            android:id="@+id/item_txt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_toRightOf="@+id/quantity_field"
            android:text="kg"
            android:textSize="@dimen/_18ssp" />

        <TextView
            android:id="@+id/decreaseQuantity_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="false"
            android:layout_toLeftOf="@+id/increaseQuantity_btn"
            android:background="@android:color/darker_gray"
            android:onClick="decreaseInteger"
            android:paddingLeft="@dimen/_20sdp"
            android:paddingRight="@dimen/_20sdp"
            android:text="-"
            android:textColor="@android:color/background_light"
            android:textSize="@dimen/_18ssp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/increaseQuantity_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginLeft="@dimen/_10sdp"
            android:background="@android:color/holo_orange_dark"
            android:onClick="increaseInteger"
            android:paddingLeft="@dimen/_20sdp"
            android:paddingRight="@dimen/_20sdp"
            android:text="+"
            android:textColor="@android:color/background_light"
            android:textSize="@dimen/_18ssp"
            android:textStyle="bold" />
    </RelativeLayout>

    </LinearLayout>

   <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="#fff"
    android:gravity="center"
    android:orientation="horizontal">

    <android.support.v7.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/_8sdp"
        android:layout_marginLeft="@dimen/_5sdp"
        android:layout_marginRight="@dimen/_5sdp"
        android:layout_marginTop="@dimen/_8sdp"
        app:cardCornerRadius="@dimen/_3sdp"
        app:cardElevation="@dimen/_4sdp">

        <TextView
            android:id="@+id/AddToCartFromProduct_field"
            android:layout_width="@dimen/_135sdp"
            android:layout_height="wrap_content"
            android:background="@drawable/bg_horizon_gradient"
            android:gravity="center"
            android:paddingBottom="@dimen/_10sdp"
            android:paddingTop="@dimen/_10sdp"
            android:text="ADD TO CART"
            android:textColor="#fff"
            android:textSize="@dimen/_14ssp"
            android:textStyle="bold" />
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="@dimen/_8sdp"
        android:layout_marginLeft="@dimen/_5sdp"
        android:layout_marginRight="@dimen/_5sdp"
        android:layout_marginTop="@dimen/_8sdp"
        app:cardCornerRadius="@dimen/_3sdp"
        app:cardElevation="@dimen/_4sdp">

        <TextView
            android:id="@+id/buyNow_field"
            android:layout_width="@dimen/_135sdp"
            android:layout_height="wrap_content"
            android:background="@drawable/bg_horizon_gradient"
            android:gravity="center"
            android:paddingBottom="@dimen/_10sdp"
            android:paddingTop="@dimen/_10sdp"
            android:text="BUY NOW"
            android:textColor="#fff"
            android:textSize="@dimen/_14ssp"
            android:textStyle="bold" />
    </android.support.v7.widget.CardView>
   </LinearLayout>
   </RelativeLayout>

Мне нужно вот так, но кнопки ниже скрыты

1 Ответ

0 голосов
/ 27 августа 2018
<?xml version="1.0" encoding="utf-8"?>
<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.support.design.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:elevation="0dp">

            <android.support.v7.widget.Toolbar
                android:id="@+id/Toolbar"
                android:layout_width="match_parent"
                android:layout_height="?actionBarSize" />

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

        <FrameLayout
            android:id="@+id/view_stub"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                android:gravity="center">
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center">
                    <Button
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:gravity="center"
                        android:layout_gravity="center"/>
                </LinearLayout>
            </RelativeLayout>
        </FrameLayout>

    </android.support.design.widget.CoordinatorLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/Navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start" />

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