2017-10-03 14 views
0

Ceci est le code xml pour mon fragment. Je suis capable d'afficher la disposition linéaire au-dessus de recyclerview mais le problème est, la disposition linéaire ne s'aligne pas en bas de l'écran. Devrais-je utiliser la disposition relative au lieu de framelayout?Je veux afficher la disposition linéaire en bas de l'écran. Comment puis-je l'aligner en bas?

<FrameLayout 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" 
tools:context="com.example.dell.pollachiclient.MyCartFragment"> 

<android.support.v7.widget.RecyclerView 
    android:id="@+id/recycler_view_cart" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    /> 
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="70dp" 
    android:layout_gravity="bottom" 
    android:orientation="horizontal" 
    android:background="#Fff" 
    > 

    <TextView 
     android:id="@+id/setup_macroSavebtn" 
     android:layout_width="0dp" 
     android:layout_height="70dp" 
     android:layout_gravity="start" 
     android:gravity="center_vertical|center_horizontal" 
     android:layout_weight="1" 
     android:textColor="#000" 
     android:background="#Fff" 
     android:textStyle="normal" 
     android:textSize="22sp" 
     android:text="$500.00"/> 

    <Button 
     android:id="@+id/setup_macroCancelbtn" 
     android:layout_width="0dp" 
     android:layout_height="50dp" 
     android:layout_gravity="center" 
     android:layout_marginTop="20dp" 
     android:gravity="center_vertical|center_horizontal" 
     android:layout_margin="10dp" 
     android:layout_weight="1" 
     android:textColor="#fff" 
     android:background="#FA631D" 
     android:text="Checkout"/> 
    </LinearLayout> 

</FrameLayout> 

Screenshot

Répondre

0

Utilisation RelativeLayout au lieu de FrameLayout et utiliser

android:layout_alignParentBottom="true" 

dans le LinearLayout que vous souhaitez voir apparaître en bas.

0

utilisateur RelativeLayout et aller avec

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="70dp" 
    android:orientation="horizontal" 
    android:background="#Fff" 
    android:layout_below="@id/recycler_view_cart" 
    > 
0
<?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" 
    android:background="@color/White"> 

    <Recycalvire 
     android:id="@+id/container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@+id/view_a" /> 

    <View 
     android:id="@+id/view_a" 
     android:layout_width="match_parent" 
     android:layout_height="1dp" 
     android:layout_above="@+id/bottom_layout" 
     android:background="@color/col1"></View> 

    <Linearlayout 
     layout="@layout/buttom_menu" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" /> 
</RelativeLayout> 
0

Essayez ceci comme une réponse par @Nabin Bhandari

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/recycler_view_cart" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"/> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="70dp" 
     android:layout_gravity="bottom" 
     android:background="#Fff" 
     android:layout_alignParentBottom="true" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/setup_macroSavebtn" 
      android:layout_width="0dp" 
      android:layout_height="70dp" 
      android:layout_gravity="start" 
      android:layout_weight="1" 
      android:background="#Fff" 
      android:gravity="center_vertical|center_horizontal" 
      android:text="$500.00" 
      android:textColor="#000" 
      android:textSize="22sp" 
      android:textStyle="normal" /> 

     <Button 
      android:id="@+id/setup_macroCancelbtn" 
      android:layout_width="0dp" 
      android:layout_height="50dp" 
      android:layout_gravity="center" 
      android:layout_margin="10dp" 
      android:layout_marginTop="20dp" 
      android:layout_weight="1" 
      android:background="#FA631D" 
      android:gravity="center_vertical|center_horizontal" 
      android:text="Checkout" 
      android:textColor="#fff" /> 

    </LinearLayout> 

</RelativeLayout>