Android EditText pushing view down - android

I have the following view:
And every time I edit the search EditText (even when there is no text change, just focusing), my View does this:
My XML code is this:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:windowSoftInputMode="adjustNothing"
tools:context="garbi.mx.garbi.Home">
<!-- The main content view -->
<RelativeLayout
android:id="#+id/mainContent"
android:layout_width="match_parent"
android:background="#ffffff"
android:layout_height="match_parent" >
<FrameLayout
android:layout_marginTop="80dp"
android:layout_marginBottom="140dp"
android:id="#+id/mapFrame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="#+id/map"
android:layout_marginTop="10dp"
android:layout_margin="10dp"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/geolocation"
android:layout_marginRight="20dp"
android:onClick="centerMap"
android:layout_marginBottom="30dp"
android:background="#00ffffff"
android:layout_gravity="bottom|right"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/marker"
android:layout_gravity="center" />
</FrameLayout>
<TextView
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:text="¿Dónde se encuentra tu coche?"
android:textColor="#43B9BD"
android:textStyle="bold"
android:gravity="center"
android:layout_height="25dp"
android:id="#+id/textView" />
<!--<EditText
android:id="#+id/places_autocomplete"
android:layout_width="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="30dp"
android:textSize="14dp"
android:layout_height="55dp"
android:layout_alignParentTop="true"
android:layout_toEndOf="#+id/imageView" />-->
<com.seatgeek.placesautocomplete.PlacesAutocompleteTextView
android:id="#+id/places_autocomplete"
android:layout_width="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="30dp"
android:textSize="14dp"
android:layout_height="55dp"
app:pacv_googleMapsApiKey="AIzaSyBjn1_8gclbpsRvfO6ndKQKEuCLUaARw5s"
android:layout_alignParentTop="true"
android:layout_toEndOf="#+id/imageView" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="#drawable/search"
android:layout_below="#+id/textView"
android:layout_alignParentStart="true"
android:layout_marginStart="16dp"
android:id="#+id/imageView"
android:layout_alignBottom="#+id/places_autocomplete" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:weightSum="2"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_above="#+id/imageButton">
<Button
android:layout_margin="5dp"
android:layout_width="0dp"
android:padding="5dp"
android:layout_height="50dp"
android:background="#drawable/field_small"
android:textAllCaps="false"
android:textColor="#color/textColor"
android:onClick="setCar"
android:id="#+id/carButton"
android:text="Agregar \nVehículo"
android:layout_weight="1"/>
<Button
android:layout_margin="5dp"
android:layout_width="0dp"
android:layout_height="50dp"
android:background="#drawable/field_small"
android:textAllCaps="false"
android:onClick="setPayment"
android:id="#+id/paymentButton"
android:textColor="#color/textColor"
android:text="Agregar \nMétodo de pago"
android:layout_weight="1"/>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Solicitar Garbi"
android:textSize="16dp"
android:textAllCaps="false"
android:textStyle="bold"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#ffffff"
android:background="#drawable/large_button"
android:id="#+id/imageButton"
android:onClick="request"
android:layout_marginBottom="15dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
<!-- The navigation drawer -->
<RelativeLayout
android:layout_width="280dp"
android:layout_height="match_parent"
android:id="#+id/drawerPane"
android:layout_gravity="start">
<!-- Profile Box -->
<RelativeLayout
android:id="#+id/profileBox"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#color/colorAccent"
android:onClick="editProfile"
android:padding="8dp" >
<ImageView
android:id="#+id/avatar"
android:layout_width="75dp"
android:layout_height="75dp"
android:src="#drawable/rain"
android:layout_marginTop="15dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/avatar"
android:orientation="vertical" >
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginTop="15dp" />
<TextView
android:layout_marginTop="-10dp"
android:id="#+id/userName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Isabel Tapia Reyes"
android:textColor="#fff"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
<!-- List of Actions (pages) -->
<ListView
android:layout_marginTop="100dp"
android:id="#+id/navList"
android:layout_width="280dp"
android:layout_height="match_parent"
android:choiceMode="singleChoice"
android:divider="#null"
android:dividerHeight="0dp"
android:background="#ffffffff"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
Experimenting with it has lead me to think this has to do with the length of the texts inside the buttons (they are dynamic). If the button has more than one line, it is going to get pushed down. One line does ok.

You can follow any of the two options:
1.Add android:baselineAligned="false" to your LinearLayout containing the buttons
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_above="#+id/imageButton"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:baselineAligned="false"
android:orientation="horizontal"
android:weightSum="2">
2.Use android:layout_height="match_parent" for the child element to grow it's view equally when the text changes
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/imageButton"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal"
android:weightSum="2">
<Button
android:id="#+id/carButton"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:onClick="setCar"
android:padding="5dp"
android:text="Agregar \nVehículTestTestTestTestTest"
android:textAllCaps="false"
android:textColor="#color/color_black" />
<Button
android:id="#+id/paymentButton"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:layout_weight="1"
android:onClick="setPayment"
android:text="Agregar \nMétodo de pago"
android:textAllCaps="false"
android:textColor="#color/color_black" />
</LinearLayout>

Related

Recycler view not visible when i add scrollview as a parent of Linear layout where Recycler view is placed with frame layout and swipe refresh layout

Recyler view items are not displayed when i placed parent of the same inside scrollview or nested scrollview.
My requirement is to add scrollview to half of the screen which includes recyclerview with frame layout and swipe refresh layout.
I have tried scrollview and nestedscrollview but its not coming.
<?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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/restaurant_list_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/img_cusine_1"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginLeft="0dp"
android:layout_marginTop="2dp"
android:layout_marginRight="0dp"
android:scaleType="fitXY"
android:src="#drawable/food_1" />
<ImageView
android:id="#+id/arrow_white"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignBottom="#id/img_cusine_1"
android:layout_marginLeft="20dp"
android:layout_marginBottom="30dp"
android:src="#drawable/white_arrow" />
<TextView
android:id="#+id/detail_restaurant_name"
android:layout_width="183dp"
android:layout_height="27dp"
android:layout_alignTop="#+id/arrow_white"
android:layout_alignBottom="#id/img_cusine_1"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginStart="20dp"
android:layout_marginLeft="31dp"
android:layout_marginTop="-2dp"
android:layout_marginEnd="125dp"
android:layout_marginRight="125dp"
android:layout_marginBottom="30dp"
android:layout_toEndOf="#+id/arrow_white"
android:layout_toRightOf="#+id/arrow_white"
android:text="Restaurant Name"
android:textColor="#color/white"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/detail_restaurant_name_sub"
style="#style/RestuarantNames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:text="Restuarant Name" />
<TextView
android:id="#+id/detail_restaurant_ratings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:background="#color/textGreen"
android:text="3.6"
android:textColor="#color/white"
tools:ignore="RtlHardcoded" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
style="#style/UserLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="#string/detail_retaurant_list_ratings_header" />
<ImageView
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_marginTop="2dp"
android:src="#drawable/rating" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
style="#style/UserLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="#string/detail_retaurant_list_delivery_place_header" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal">
<ImageView
android:id="#+id/green_arrow"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="User Location"
android:src="#drawable/icon_user_location"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/user_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="146dp"
android:layout_marginRight="146dp"
android:layout_marginBottom="-6dp"
android:text="Rajouri Garden"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<!--<TextView
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/user_address_change"
android:text="#string/user_change"
android:layout_marginRight="10dp"
style="#style/User_Green_Font" />-->
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="#android:color/darker_gray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="Delivery in 33 minutes.Live tracking available"
android:textColor="#FF7F50"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="#android:color/darker_gray" />
<Switch
android:id="#+id/vegSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="#string/dish_type_veg"
android:textColor="#color/grey"
android:textStyle="bold" />
<TextView
style="#style/HeaderRestuarantsRecommendations"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/dish_type_best_sellers" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_food_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</android.support.v4.widget.SwipeRefreshLayout>
<com.andremion.counterfab.CounterFab
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|end"
android:src="#drawable/ic_shopping_cart_black_24dp"
app:backgroundTint="#3CB371"
tools:ignore="VectorDrawableCompat" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
I need to display image which is inside relativelayout, rest of the contents should be scrollable below image including recylerview contents.
Right now If i put scrollview after relative layout,recyler views contents doesnt show up,without scrollview recyler view lists comes with a scrollbar.
<LinearLayout
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:layout_margin="10dp"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/restaurant_list_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/img_cusine_1"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginLeft="0dp"
android:layout_marginTop="2dp"
android:layout_marginRight="0dp"
android:scaleType="fitXY"
android:src="#drawable/ic_launcher_background" />
<ImageView
android:id="#+id/arrow_white"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignBottom="#+id/img_cusine_1"
android:layout_marginLeft="20dp"
android:layout_marginBottom="30dp"
android:src="#android:drawable/arrow_down_float" />
<TextView
android:id="#+id/detail_restaurant_name"
android:layout_width="183dp"
android:layout_height="27dp"
android:layout_alignTop="#+id/arrow_white"
android:layout_alignBottom="#id/img_cusine_1"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginStart="20dp"
android:layout_marginLeft="31dp"
android:layout_marginTop="-2dp"
android:layout_marginEnd="125dp"
android:layout_marginRight="125dp"
android:layout_marginBottom="30dp"
android:layout_toEndOf="#+id/arrow_white"
android:layout_toRightOf="#+id/arrow_white"
android:text="Restaurant Name"
android:textColor="#android:color/white"
android:textStyle="bold" />
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_wienter code heredth="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/detail_restaurant_name_sub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:text="Restuarant Name" />
<TextView
android:id="#+id/detail_restaurant_ratings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:background="#android:color/holo_green_dark"
android:text="3.6"
android:textColor="#android:color/white"
tools:ignore="RtlHardcoded" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="String text" />
<ImageView
android:layout_width="250dp"
android:layout_height="30dp"
android:layout_marginTop="2dp"
android:src="#android:drawable/btn_radio" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="detail_retaurant_list_delivery_place_header" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal">
<ImageView
android:id="#+id/green_arrow"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="User Location"
android:src="#android:drawable/btn_radio"
tools:ignore="HardcodedText" />
<TextView
android:id="#+id/user_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="146dp"
android:layout_marginRight="146dp"
android:layout_marginBottom="-6dp"
android:text="Rajouri Garden"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="#android:color/darker_gray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="Delivery in 33 minutes.Live tracking available"
android:textColor="#FF7F50"
android:textStyle="bold" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="5dp"
android:background="#android:color/darker_gray" />
<Switch
android:id="#+id/vegSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="dish_type_veg"
android:textColor="#android:color/darker_gray"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="string/dish_type_best_sellers" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="#+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recycler_food_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|end"
app:backgroundTint="#3CB371"
tools:ignore="VectorDrawableCompat" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
I guess this will work. I changed the FrameLayout to RelativeLayout and then added android:fillViewport="true" to Nestedscrollview. Now the recyclerview seems to be visible. You can try the same and let me know if it works

How to properly use linear layout in Android programming

I'm trying to create a layout that has a 4 categories on the page, and in each one 2 spinners with a title. However at the moment my layout is all over the place when i run an emulator. How can i fix this? i feel like i'm not understanding the concept of the layout properly since everything i add becomes rigid to the layout and i can't easily move things.
layout
<LinearLayout 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"
android:orientation="vertical"
tools:context=".Page1Fragment">
<TextView
android:id="#+id/TextView0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginTop="25dp"
android:background="#A0DD0A"
android:text="TITLE" />
<LinearLayout
android:id="#+id/LinearLayoutTop"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/LinearLayoutTopSub"
android:layout_width="match_parent"
android:layout_height="134dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="horizontal">
<TextView
android:id="#+id/TextView1"
android:layout_width="81dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:text="Weight" />
<Spinner
android:id="#+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="25dp" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/spinner"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="25dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayoutTopSub2"
android:layout_width="match_parent"
android:layout_height="134dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="horizontal">
<TextView
android:id="#+id/TextView2"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:text="Computer" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="25dp" />
<Spinner
android:id="#+id/spinner3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/spinner2"
android:layout_marginLeft="0dp"
android:layout_marginTop="85dp"
android:layout_marginRight="30dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:background="#FFFFFF">
<LinearLayout
android:id="#+id/LinearLayoutTopSub3"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="horizontal">
<TextView
android:id="#+id/TextView4"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:text="Distance" />
<Spinner
android:id="#+id/spinner4"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="25dp" />
<Spinner
android:id="#+id/spinner5"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="0dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayoutTopSub4"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="horizontal">
<TextView
android:id="#+id/TextView5"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:text="Other" />
<Spinner
android:id="#+id/spinner6"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="25dp" />
<Spinner
android:id="#+id/spinner7"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginTop="55dp"
android:layout_marginRight="0dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
I have added new linear and removed weight. try this one.
<LinearLayout 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"
android:orientation="vertical"
tools:context=".Page1Fragment">
<TextView
android:id="#+id/TextView0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginTop="25dp"
android:background="#A0DD0A"
android:text="TITLE" />
<!-- adding new linear -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/LinearLayoutTop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/LinearLayoutTopSub"
android:layout_width="wrap_content"
android:layout_height="134dp"
android:background="#FFFFFF"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/TextView1"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:background="#FFFFFF"
android:text="Weight" />
<Spinner
android:id="#+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayoutTopSub3"
android:layout_width="wrap_content"
android:layout_height="134dp"
android:background="#FFFFFF"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/TextView3"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:background="#FFFFFF"
android:text="Computer" />
<Spinner
android:id="#+id/spinner3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="#+id/spinner4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayoutBot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/LinearLayoutBotSub"
android:layout_width="wrap_content"
android:layout_height="134dp"
android:background="#FFFFFF"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/TextView4"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:background="#FFFFFF"
android:text="Distance" />
<Spinner
android:id="#+id/spinner9"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="#+id/spinner7"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/LinearLayoutTopSub2"
android:layout_width="wrap_content"
android:layout_height="134dp"
android:background="#FFFFFF"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/TextView2"
android:layout_width="150dp"
android:layout_height="20dp"
android:layout_margin="10dp"
android:background="#FFFFFF"
android:text="Others" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:id="#+id/spinner5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

Custom NavigationDrawer sometimes not working properly

I have a custom navigation drawer. I user Support library's DrawerLayout.
My problem is that ONLY sometimes when I click on the hamburger icon, a shadow appears and the side menu (drawer layout) does not get open.
I have tried this solution offered in SO but didn't work:
drawerLayout.setScrimColor(Color.TRANSPARENT);
Here is how it looks:
Before clicking on the icon:
Here is how it looks those SOMETIMES that clicking doesn't work:
Here is how it looks when everything is working fine:
Here is my layout file:
<android.support.v4.widget.DrawerLayout 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:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.parsdigit.helsa.Activity.Main">
<!-- Main Layouts ... -->
<RelativeLayout
android:background="#color/red"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white">
<FrameLayout
android:background="#color/blue"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="#+id/fragmentHolder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorGray" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Laundry Info Layout -->
<LinearLayout
android:id="#+id/laundryInfoLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/transparent"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_alignParentBottom="true"
android:layout_weight="0.3"
android:background="#android:color/transparent"
android:gravity="right|center_vertical"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_alignParentBottom="true"
android:layout_weight="0.7"
android:background="#android:color/white"
android:orientation="horizontal">
<include
layout="#layout/pin_info_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
<!-- Invoice Info Layout -->
<LinearLayout
android:id="#+id/invoiceInfoLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:background="#25a5cc"
android:orientation="vertical"
android:visibility="gone">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dp"
android:layout_marginEnd="40dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginStart="40dp"
android:layout_marginTop="10dp"
android:layout_weight="0.85"
android:background="#drawable/solid_line_2_no_border_less_round"
android:gravity="center">
<TextView
android:id="#+id/txtSumTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:text="جمع کل : "
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:textColor="#color/textColorGray" />
<TextView
android:id="#+id/txtSum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:text="250000 تومان"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:textColor="#color/textColorGray" />
<TextView
android:id="#+id/txtDeliveryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/txtSumTitle"
android:layout_marginBottom="5dp"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:text="هزینه حمل : "
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:textColor="#color/textColorGray" />
<TextView
android:id="#+id/txtDelivery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/txtSum"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:text="رایگان"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:textColor="#color/textColorGray" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:background="#drawable/solid_line_no_border_less_round">
<Button
android:id="#+id/btnPayInvoice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="-5dp"
android:layout_marginRight="-5dp"
android:background="#drawable/gradiant_payment_full_rounded"
android:text="پرداخت"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:textColor="#android:color/white" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_toLeftOf="#id/btnPayInvoice"
android:layout_toStartOf="#id/btnPayInvoice"
android:text="مبلغ قابل پرداخت :"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:textColor="#color/textColorGray" />
<TextView
android:id="#+id/txtSumInvoice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:text="250000 تومان"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:textColor="#color/textColorGray" />
</RelativeLayout>
</LinearLayout>
</FrameLayout>
</FrameLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/mainBottomLayout"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:orientation="horizontal"
android:visibility="visible">
<RelativeLayout
android:id="#+id/btnSummary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
<RelativeLayout
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
<RelativeLayout
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerInParent="true"
android:background="#drawable/ic_basket_summary" />
</RelativeLayout>
<RelativeLayout
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
<com.nex3z.notificationbadge.NotificationBadge
android:id="#+id/allBadge"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentTop="true"
android:textAlignment="center"
app:nbBackground="#drawable/badge_circle"
app:nbMaxTextLength="2"
app:nbTextColor="#android:color/white"
app:nbTextSize="10sp" />
</RelativeLayout>
</RelativeLayout>
<Button
android:id="#+id/btnNext"
android:layout_width="25dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:background="#drawable/ic_forward" />
<Button
android:id="#+id/btnPrevious"
android:layout_width="25dp"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:background="#drawable/ic_backward" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/dimLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.7"
android:background="#android:color/black"
android:visibility="gone" />
</RelativeLayout>
<!-- Menu Layouts ... -->
<io.codetail.widget.RevealFrameLayout
android:id="#+id/container_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/content_overlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
<LinearLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:minHeight="?attr/actionBarSize"
app:contentInsetEnd="0dp"
app:contentInsetStart="0dp">
<RelativeLayout
android:id="#+id/topButtonsLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/txtMainTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:textColor="#1a7acf" />
<LinearLayout
android:id="#+id/btnMenuLayout"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:padding="0dp"
>
<Button
android:id="#+id/btnMenu"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="#drawable/ic_menu"
android:visibility="visible" />
</LinearLayout>
<Button
android:id="#+id/btnBackMenu"
android:layout_width="24dp"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_marginStart="15dp"
android:layout_marginTop="10dp"
android:background="#drawable/ic_back_top" />
<com.airbnb.lottie.LottieAnimationView
android:id="#+id/btnPremium"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginBottom="5dp"
android:layout_marginEnd="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
app:lottie_autoPlay="true"
app:lottie_fileName="diamonds.json"
app:lottie_loop="true" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
</io.codetail.widget.RevealFrameLayout>
<ScrollView
android:id="#+id/scrollView"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="start|bottom"
android:scrollbarThumbVertical="#android:color/transparent">
<LinearLayout
android:id="#+id/left_drawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:divider="#android:color/transparent"
android:orientation="vertical"></LinearLayout>
</ScrollView>
How do I know what layout is this gray shadow?

Change activity or scroll activity when keyboard appear

I have an recycleview in the end of activity but i want,when keyboard appear on click field_comment_form
the activity goes up to the EditText and only EditText and recycleview will be seen
I already tried many ways including
windowSoftInputMode:adjustResize
my code of xml is below:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="3dp">
<android.support.v7.widget.CardView
android:id="#+id/post_text_layout_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:cardCornerRadius="1dp"
app:cardElevation="5dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<include
android:id="#+id/post_author_layout"
layout="#layout/include_post_author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" />
<LinearLayout
android:id="#+id/star_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/post_author_layout"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/post_author_layout"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="#+id/star_cmnt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:background="?attr/selectableItemBackground"
android:src="#drawable/ic_create_black_24dp" />
<TextView
android:id="#+id/post_num_stars_cmnt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#000"
android:textStyle="bold"
tools:text="7" />
</LinearLayout>
<include
layout="#layout/include_post_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/post_author_layout"
android:layout_marginLeft="5dp"
android:layout_marginTop="10dp" />
</RelativeLayout>
</android.support.v7.widget.CardView>
<LinearLayout
android:id="#+id/comment_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/post_text_layout_card"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="5dp"
android:background="#drawable/cmnt_post_box_back"
android:orientation="horizontal"
android:weightSum="1.0">
<EditText
android:id="#+id/field_comment_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:breakStrategy="balanced"
android:fitsSystemWindows="true"
android:gravity="top"
android:hint="Write a comment..."
android:maxLines="2" />
<Button
android:id="#+id/button_post_comment"
style="#style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:text="Post" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_comments"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/comment_form"
tools:listitem="#layout/item_comment" />
</RelativeLayout>`
screenshot is here

How to make old layouts visible?

I have a layout that is shown correctly, but after adding DrawerLayout my old layouts were hidden. Here is my code after adding drawer:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:weightSum="2"
android:layout_height="match_parent">
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<include
android:id="#+id/activity_base"
layout="#layout/activity_base"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2">
<RelativeLayout
android:id="#+id/resturantlayout"
android:layout_width="0dp"
android:layout_marginTop="10dp"
android:layout_marginRight="5dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#bd4304">
<TextView
android:text="رستوران"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/txtresturant"
android:textSize="18sp"
android:textStyle="normal|bold"
android:layout_centerHorizontal="true"
android:layout_below="#+id/imageButtonresturant" />
<ImageButton
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_marginTop="30dp"
android:background="#drawable/resturantlogo"
android:id="#+id/imageButtonresturant"
android:scaleType="fitXY"
/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/coffeshoplayout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="5dp"
android:background="#d2ae6d">
<ImageButton
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_marginTop="30dp"
android:background="#drawable/cofeelogo"
android:id="#+id/imageButtencofee"
/>
<TextView
android:text="کافه ها"
android:layout_marginTop="13dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textViewcofee"
android:textStyle="normal|bold"
android:textSize="18sp"
android:layout_below="#+id/imageButtencofee"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/servfoodlayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:weightSum="2">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:background="#f58634">
<ImageButton
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_marginTop="30dp"
android:background="#drawable/ghazalogo"
android:id="#+id/imageButtonghaza" />
<TextView
android:text="غذای آماده"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="normal|bold"
android:textSize="18sp"
android:id="#+id/textViewgghaza"
android:layout_below="#+id/imageButtonghaza"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="10dp"
android:background="#7db446">
<TextView
android:text="فست فود"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView3"
android:layout_marginTop="10dp"
android:textStyle="normal|bold"
android:textSize="18sp"
android:layout_below="#+id/imageButtonfastfood"
android:layout_centerHorizontal="true" />
<ImageButton
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_marginTop="30dp"
android:background="#drawable/fastfoodlogo"
android:id="#+id/imageButtonfastfood"
/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<FrameLayout
android:id="#+id/drawer_frame_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_marginLeft="56dp"
android:choiceMode="singleChoice"
android:dividerHeight="1dp" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
The ids of two old layouts are: "cofeeshoprow, servfoodlayout" that they were shown correct.
I should have used android:layout_below="#+id/activity_base" for the layouts which should be shown below the "activity_base". Generally in this cases try to match layouts using "android:layout_below".

Categories

Resources