Custom NavigationDrawer sometimes not working properly - android

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?

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

I do not want collapsing toolbar to scroll at all inside coordinator layout

I have a code here which contains of a coordinator layout. Inside that coordinator layout, there is an appbar layout and a nested scrollview beneath it.I want the appbar layout(map) to be still even when nestedscroll view scrolls.I have images to explain my thoughts. Initial stage, stage two. Notice that the map remains still while only nested scroll view scrolls and finally, nested scroll view overlaps entire map fragment.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#android:color/white">
<android.support.design.widget.AppBarLayout
android:id="#+id/MyAppbar"
android:layout_width="match_parent"
android:layout_height="550dp"
android:fitsSystemWindows="true"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapse_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true">
<android.support.v7.widget.Toolbar
android:id="#+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="60dp"
app:layout_collapseMode="pin"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/close_button"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_centerVertical="true"
android:src="#drawable/close_black"
/>
<TextView
android:id="#+id/shipping_to_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SHIPPING TO"
android:textColor="#color/black"
android:textStyle="bold"
android:textSize="10dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"/>
<TextView
android:id="#+id/shipping_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="926 Rosenbaum Mill"
android:textColor="#color/black"
android:layout_below="#id/shipping_to_title"
android:textSize="16dp"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="550dp"
tools:context=".MapFragment"
android:layout_below="#id/my_toolbar"
app:layout_collapseMode="pin"
>
<RelativeLayout
android:id="#+id/outermost_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:id="#+id/bottom_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_centerHorizontal="true"
>
<include
android:id="#+id/getDirections"
layout="#layout/track_shipment_activity_get_directions_fragment_layout"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
/>
<include
android:id="#+id/received"
layout="#layout/track_shipment_activity_received_fragment_layout"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
/>
<include
android:id="#+id/enrouteToDestination"
layout="#layout/track_shipment_activity_button_fragment_layout"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
/>
<include
android:id="#+id/trackOrder"
layout="#layout/track_shipment_track_order_button_fragment_layout"
android:visibility="gone"
/>
<RelativeLayout
android:id="#+id/trackOrderBelow"
android:layout_width="300dp"
android:layout_height="40dp"
android:layout_below="#id/trackOrder"
android:layout_marginBottom="20dp"
android:background="#FBFBFB"
android:layout_centerHorizontal="true"
android:visibility="gone">
<TextView
android:id="#+id/tracking_code_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/tracking_code"
android:textSize="14dp"
android:textColor="#color/black"
android:layout_marginStart="10dp"
android:layout_centerVertical="true"/>
<TextView
android:id="#+id/tracking_code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/tracking_code_numbers"
android:layout_toRightOf="#id/tracking_code_title"
android:textSize="14dp"
android:textColor="#color/black"
android:layout_marginStart="10dp"
android:layout_centerVertical="true" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/double_boxes"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_centerVertical="true"/>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</fragment>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView 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_gravity="fill_vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/abc"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/MyAppbar"
android:layout_marginTop="30dp"
tools:context=".MapFragment">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ScrollView
android:id="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/relative_layout_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/activity_background">
<RelativeLayout
android:id="#+id/relative_layout_inner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:focusedByDefault="true">
<ImageView
android:id="#+id/order_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="15dp"
android:layout_marginTop="25dp"
android:contentDescription="#string/app_name"
android:src="#drawable/orders" />
<TextView
android:id="#+id/order_date_title"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginTop="25dp"
android:layout_toEndOf="#id/order_icon"
android:gravity="center"
android:paddingLeft="5dp"
android:text="#string/order_date2"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/order_date"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="15dp"
android:layout_marginTop="25dp"
android:layout_toEndOf="#id/order_date_title"
android:gravity="center|end"
android:paddingLeft="90dp"
android:text="#string/date5"
android:textColor="#android:color/black"
android:textStyle="bold" />
<ImageView
android:id="#+id/placeBy_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#id/order_icon"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:contentDescription="#string/app_name"
android:src="#drawable/person" />
<TextView
android:id="#+id/placed_by_title"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/order_date_title"
android:layout_marginTop="20dp"
android:layout_toEndOf="#id/placeBy_icon"
android:gravity="center"
android:paddingLeft="5dp"
android:text="#string/placed_by"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/placed_by"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_below="#id/order_date_title"
android:layout_marginEnd="15dp"
android:layout_marginTop="20dp"
android:layout_toEndOf="#id/placed_by_title"
android:gravity="center|end"
android:paddingLeft="100dp"
android:text="#string/user_name"
android:textColor="#android:color/black"
android:textStyle="bold" />
<ImageView
android:id="#+id/delivery_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#id/placeBy_icon"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:contentDescription="#string/app_name"
android:src="#drawable/delivery" />
<TextView
android:id="#+id/delivery_method_title"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/placed_by_title"
android:layout_marginTop="20dp"
android:layout_toEndOf="#id/delivery_icon"
android:gravity="center"
android:paddingLeft="5dp"
android:text="#string/delivery_method"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/delivery_method"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_below="#id/placed_by_title"
android:layout_marginEnd="15dp"
android:layout_marginTop="20dp"
android:layout_toEndOf="#id/delivery_method_title"
android:gravity="center|end"
android:text="#string/shipping"
android:textColor="#android:color/black"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/add_to_calander_button_shipment"
android:layout_width="340dp"
android:layout_height="40dp"
android:layout_below="#+id/delivery_icon"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:background="#drawable/add_to_calander">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true">
<ImageView
android:id="#+id/addToCalIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/app_name"
android:src="#drawable/orders" />
<TextView
android:id="#+id/addToCalText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="2dp"
android:layout_toEndOf="#id/addToCalIcon"
android:text="#string/add_to_calander"
android:textSize="14dp" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<View
android:id="#+id/threeItems"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="#+id/relative_layout_inner"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:background="#color/activity_background" />
<TextView
android:id="#+id/threeItemstext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relative_layout_inner"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:text="#string/number_of_items"
android:textColor="#color/black"
android:textSize="16dp"
android:textStyle="bold" />
<android.support.v4.widget.NestedScrollView
android:id="#+id/nestedRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/threeItems">
<android.support.v7.widget.RecyclerView
android:id="#+id/simpleRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:nestedScrollingEnabled="false"
app:layout_behavior="#string/app_bar_scrolling_view_behavior">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.NestedScrollView>
<include
android:id="#+id/delivery_details"
layout="#layout/track_shipment_delivery_details_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/nestedRecyclerView"
android:layout_marginBottom="5dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp" />
<include
android:id="#+id/order"
layout="#layout/track_shipment_order_total_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/delivery_details"
android:layout_marginBottom="5dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp" />
<include
android:id="#+id/need_help"
layout="#layout/track_shipment_need_help_fragment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/order"
android:layout_marginBottom="10dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Try adding
app:behavior_overlapTop="0dp" in your nested scroll view and also add some elevation to the nested scroll view.

Android EditText pushing view down

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>

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".

Tabs with custom view is not inflating in TabLayout at bottom of screen

I have a layout as following -
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:orientation="vertical"
android:weightSum="6"
android:id="#+id/main_global_container"
>
<!--<include-->
<!--android:id="#+id/mainAppBar"-->
<!--layout="#layout/view_appbar" />-->
<!--<ProgressBar-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--style="#android:style/Widget.Holo.Light.ProgressBar.Large"-->
<!--android:layout_margin="35dp"-->
<!--android:id="#+id/homescreenProgressbar"-->
<!--android:gravity="center_horizontal"-->
<!--android:visibility="invisible"-->
<!--/>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:weightSum="3"
android:layout_weight="2.5"
android:background="#color/black"
android:id="#+id/upper_container">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.7"
android:weightSum="2"
android:background="#color/formInactiveFont"
android:id="#+id/upper_left_container"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:text="Welcome,"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="21dp"
android:id="#+id/textView5"
/>
<TextView
android:text="Devansh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="22dp"
android:layout_marginStart="22dp"
android:layout_marginTop="42dp"
android:id="#+id/textView6"
/>
<TextView
android:text="Custome message will appear here"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="73dp"
android:id="#+id/textView7"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:srcCompat="#drawable/hexagone"
android:id="#+id/imageView"
android:layout_marginRight="12dp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="12dp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/black"
android:layout_centerHorizontal="true"
android:id="#+id/view4"
android:layout_marginTop="7dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:text="100"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="27dp"
android:id="#+id/textView8"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="12dp"
android:layout_marginEnd="12dp"
android:background="#drawable/hexagone"/>
<TextView
android:text="Total Score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="23dp"
android:layout_marginStart="23dp"
android:layout_marginTop="13dp"
android:id="#+id/textView11"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:text="Begainner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView12"
android:layout_centerVertical="true"
android:layout_alignLeft="#+id/textView11"
android:layout_alignStart="#+id/textView11" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.3"
android:background="#color/accentColor"
android:id="#+id/upper_right_container"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="Keep Learning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView13"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:srcCompat="#drawable/logo"
android:id="#+id/imageView2"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<Button
android:text="Take Quiz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignRight="#+id/textView13"
android:layout_alignEnd="#+id/textView13"
style="#style/quizBtnHome"
android:id="#+id/button4" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:layout_weight="3.5"
android:id="#+id/bottom_container">
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/home_view_pager">
</android.support.v4.view.ViewPager>
</LinearLayout>
<android.support.design.widget.TabLayout
android:id="#+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:minHeight="100dp"
app:tabGravity="fill"
app:tabMode="fixed"
/>
</LinearLayout>
i am inflating tabs in tablayout with following xml layout -
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#android:drawable/star_big_on"
android:id="#+id/imageView3"
/>
<TextView
android:text="Topic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView10"
android:layout_margin="7dp" />
</LinearLayout>
then i am setting up viewpager with my tablayout .
The problem is that i am getting an empty tab layout with empty tabs , they not showing their layout but if i exclude view pager then they are getting inflated properly and show what they are supposed to show .
Please help . Thanks in advance.
Try this it was happening due to LinearLayout weight i have made changes to set TabLayout bottom and LinearLayout Above Tab Layout.
<?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:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/main_global_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:orientation="vertical"
android:weightSum="6"
android:layout_above="#+id/tabLayout">
<!--<include-->
<!--android:id="#+id/mainAppBar"-->
<!--layout="#layout/view_appbar" />-->
<!--<ProgressBar-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--style="#android:style/Widget.Holo.Light.ProgressBar.Large"-->
<!--android:layout_margin="35dp"-->
<!--android:id="#+id/homescreenProgressbar"-->
<!--android:gravity="center_horizontal"-->
<!--android:visibility="invisible"-->
<!--/>-->
<LinearLayout
android:id="#+id/upper_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2.5"
android:background="#color/black"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:id="#+id/upper_left_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.7"
android:background="#color/formInactiveFont"
android:orientation="vertical"
android:weightSum="2">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="21dp"
android:text="Welcome,"
/>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="22dp"
android:layout_marginStart="22dp"
android:layout_marginTop="42dp"
android:text="Devansh"
/>
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="73dp"
android:text="Custome message will appear here"
/>
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
custom:srcCompat="#drawable/hexagone"/>
</RelativeLayout>
<View
android:id="#+id/view4"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="7dp"
android:background="#color/black"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="27dp"
android:background="#drawable/hexagone"
android:gravity="center"
android:text="100"/>
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="23dp"
android:layout_marginStart="23dp"
android:layout_marginTop="13dp"
android:text="Total Score"/>
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView11"
android:layout_alignStart="#+id/textView11"
android:layout_centerVertical="true"
android:text="Begainner"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/upper_right_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.3"
android:background="#color/accentColor"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:text="Keep Learning"/>
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
custom:srcCompat="#drawable/logo"/>
<Button
android:id="#+id/button4"
style="#style/quizBtnHome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView13"
android:layout_alignParentBottom="true"
android:layout_alignRight="#+id/textView13"
android:text="Take Quiz"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/bottom_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3.5"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="#+id/home_view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v4.view.ViewPager>
</LinearLayout>
</LinearLayout>
<android.support.design.widget.TabLayout
android:id="#+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:minHeight="100dp"
app:tabGravity="fill"
app:tabMode="fixed"
/>
</RelativeLayout>
I have solved it , so to anyone who might have this problem in future ,
Remove getPageTitle() method from your PagerAdaptor class and do things in this order -
add fragments to pageradaptor.
setup pageradaptor with you tabslayout
inflate tabs with custom layout

Categories

Resources