I am using drawerlayout with custom view instead of toolbar,when drawer open custom view faded,but i want when drawerlayout open custom header view should not fade.
my view look now drawerlayout screen
mainactivity.xml
<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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="#+id/header_view"
layout="#layout/layout_header_view"
android:layout_width="fill_parent"
android:layout_height="50dp" />
<FrameLayout
android:id="#+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/footer_RL"
android:layout_below="#+id/header_view">
</FrameLayout>
<RelativeLayout
android:id="#+id/footer_RL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<include
layout="#layout/layout_footer_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/drawer_List"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginTop="50dp"
android:background="#color/white"
android:choiceMode="singleChoice"
android:orientation="vertical"
android:weightSum="10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:background="#color/white"
android:orientation="vertical"
android:visibility="gone"
android:weightSum="5">
</LinearLayout>
<ListView
android:id="#+id/drawer_List1"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/white"
android:choiceMode="singleChoice" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
You can use toolbar instead of using header view.
toolbar layout
<android.support.v7.widget.Toolbar android:background="#color/colorPrimary"
android:elevation="4dp"
android:layout_height="?attr/actionBarSize"
android:layout_width="match_parent"
local:popupTheme="#style/ThemeOverlay.AppCompat.Light"
local:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto">
<include layout="#layout/textview"/>
</android.support.v7.widget.Toolbar>
textview layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Welcome"
android:textColor="#color/colorPrimaryDark"
android:textStyle="bold"
android:textAppearance="?android:textAppearanceLarge"/>
</LinearLayout>
your layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="#layout/layout_toolBar"/>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="#+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/footer_RL"
>
</FrameLayout>
<RelativeLayout
android:id="#+id/footer_RL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<!--<include-->
<!--layout="#layout/layout_footer_view"-->
<!--android:layout_width="fill_parent"-->
<!--android:layout_height="wrap_content" />-->
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/drawer_List"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginTop="50dp"
android:background="#color/colorPrimary"
android:choiceMode="singleChoice"
android:orientation="vertical"
android:weightSum="10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:background="#color/colorPrimary"
android:orientation="vertical"
android:visibility="gone"
android:weightSum="5">
</LinearLayout>
<ListView
android:id="#+id/drawer_List1"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/colorPrimary"
android:choiceMode="singleChoice" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
Related
i can' scroll my listView in DrawerLayout.
mycode activity_main:
<androidx.drawerlayout.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:layout_width="match_parent"
android:orientation="vertical"
android:id="#+id/drawerLayout"
tools:openDrawer="start"
android:fitsSystemWindows="true"
android:layout_height="match_parent"
tools:context=".activities.MapActivity">
<com.google.android.material.navigation.NavigationView
android:layout_width="match_parent"
android:id="#+id/navigationViewRight"
android:layout_marginTop="30dp"
android:layout_marginBottom="5dp"
android:layout_height="match_parent"
android:layout_gravity="end">
<include
layout="#layout/layout_evennements"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.google.android.material.navigation.NavigationView>
<com.google.android.material.navigation.NavigationView
android:layout_width="match_parent"
android:id="#+id/navigationViewLeft"
android:layout_marginTop="30dp"
android:layout_marginBottom="5dp"
android:layout_height="match_parent"
android:layout_gravity="start">
<include
layout="#layout/layout_balises"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout >
my Layout_events code :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:clickable="true"
android:id="#+id/layout_evennements"
android:theme="#style/Theme.GPRStest.NoActionBar"
android:layout_height="match_parent"
android:focusable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/dashmap2"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#color/backgroundcolor"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="#drawable/ic_baseline_close_24"
android:layout_marginStart="15dp"
tools:ignore="ContentDescription" />
</LinearLayout>
<com.gabontech.gprstest.utils.ListViewForEmbeddingInScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ListView
android:id="#+id/listview_evennements"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_below="#id/dashmap2"
android:layout_marginRight="5dp"
android:choiceMode="singleChoice"
android:divider="#android:color/transparent"
android:dividerHeight="0dp"
android:listSelector="#BFB9AF" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#id/listview_evennements"
android:layout_gravity="center"
android:background="#color/white"
android:orientation="horizontal">
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rien_a_voir"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:visibility="gone"
android:gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="#string/noEventsData"/>
</RelativeLayout>
</RelativeLayout>
i would like to scroll mylistView but it does not scrolling.i use api to fetch data and display them in my ListView. then onDrawerOpen, ListView shows data but not scrolling. hope someone may help and bring a hand on it.
How to place Tablayout below the toolbar? It is giving me an error message and when i run it the toolbar doesn't show. But when i give the Tablayout alignbottom the toolbar then shows
Here is my xml file
<RelativeLayout 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:id="#+id/rel"
tools:context="com.example.test.MainActivity">
<include
android:id="#+id/app_bar"
layout="#layout/toolbar"/>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/nvd_act_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/app_bar"
>
<FrameLayout
android:id="#+id/cont_main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/lbl_act_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Hello World!" />
</FrameLayout>
<android.support.v7.widget.RecyclerView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/lst_nav_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start|left"
android:background="#android:color/white"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" />
</android.support.v4.widget.DrawerLayout>
<RelativeLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="#2480c1"
android:gravity="center"
android:layout_gravity="center">
<android.support.design.widget.TabLayout
android:id="#+id/tbl_basic"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</android.support.design.widget.TabLayout>
<TextView
android:id="#+id/lbl_basic_content"
android:layout_below="#id/tbl_basic"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:textColor="#android:color/black" />
</RelativeLayout>
</RelativeLayout>
Here is the screen i created, the tablayout is in the bottom. I want it to be just below the toolbar. How do i do it? Thanks
Here is the error message
#id/rel is not a sibling in the same RelativeLayout
Layout constraints in a given RelativeLayout should reference other views within the same relative layout (but not itself!)
try this
change
android:layout_alignParentBottom="true" to android:layout_alignParentBottom="false"
<RelativeLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="false"
android:layout_below="#+id/app_bar "
android:background="#2480c1"
android:gravity="center"
android:layout_gravity="center">
<android.support.design.widget.TabLayout
android:id="#+id/tbl_basic"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</android.support.design.widget.TabLayout>
<TextView
android:id="#+id/lbl_basic_content"
android:layout_below="#id/tbl_basic"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:textColor="#android:color/black" />
</RelativeLayout>
If you want it below the toolbar, then put it below the toolbar:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rel"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="#+id/app_bar"
layout="#layout/toolbar" />
<RelativeLayout
android:layout_below="#id/app_bar"
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="center"
android:background="#2480c1"
android:gravity="center">
<android.support.design.widget.TabLayout
android:id="#+id/tbl_basic"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.design.widget.TabLayout>
<TextView
android:id="#+id/lbl_basic_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/tbl_basic"
android:gravity="top"
android:textColor="#android:color/black" />
</RelativeLayout>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/nvd_act_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/app_bar"
>
<FrameLayout
android:id="#+id/cont_main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/lbl_act_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Hello World!" />
</FrameLayout>
<android.support.v7.widget.RecyclerView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/lst_nav_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start|left"
android:background="#android:color/white"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" />
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
The problem is: when SwipeRefreshLayout have android:layout_height="match_parent" - nothing is showed on layout, when its set on something like 200dp it shows listview and refresh works. Listview is populated by custom adapter with rest api.
match_parent
200dp
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/Swipelayout_for_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.darek.playerandroid.PlaylistsFragment">
<ListView
android:id="#+id/lvPlaylists"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"></ListView>
</android.support.v4.widget.SwipeRefreshLayout>
Update with content_dashboard xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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/content_dashboard"
android:layout_width="match_parent"
android:scrollbars="none"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.example.darek.playerandroid.Dashboard"
tools:showIn="#layout/app_bar_dashboard"
android:background="#color/colorBackground">
<FrameLayout
android:id="#+id/frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</ScrollView>
app_bar_dashboard
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.darek.playerandroid.Dashboard">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_dashboard"
android:id="#+id/include" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="#dimen/fab_margin"
app:srcCompat="#drawable/ic_add_white_24dp"
android:visibility="invisible" />
</android.support.design.widget.CoordinatorLayout>
playlist_list_item
<?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"
android:orientation="vertical" android:layout_width="match_parent"
android:descendantFocusability="blocksDescendants"
android:layout_height="match_parent">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="#drawable/ic_nosub"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:id="#+id/imgSub"
android:background="#color/colorBackground"
android:scaleType="fitCenter"
android:layout_alignBottom="#+id/textViewPlaylistName"
android:adjustViewBounds="true"
android:cropToPadding="true" />
<TextView
android:text="Playlist name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/textViewPlaylistName"
android:textSize="24sp"
android:gravity="center_vertical"
android:layout_alignParentTop="true"
android:layout_marginLeft="#dimen/activity_vertical_margin" />
</RelativeLayout>
Here is my working code:
<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:background="#color/backgroundColor"
android:orientation="vertical"
android:paddingEnd="#dimen/normal_space_between_view_in_home"
android:paddingStart="#dimen/normal_space_between_view_in_home"
android:weightSum="1"
tools:context=".activities.DashboardActivity">
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<ListView
android:id="#+id/cardList"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
<TextView
android:id="#+id/empty_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="#string/no_data_available"
android:visibility="gone" />
</LinearLayout>
And in the fragment:
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout);
In my home screen I want to add the search box with navigation drawer but I am not able to set the non scrollable edittext over scrollview.
Here is my Code
<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/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#ecedf1">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="#dimen/_200sdp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_200sdp"
>
<EditText
android:layout_width="#dimen/_280sdp"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/_10sdp"
android:layout_height="#dimen/_40sdp"
android:text="fdgsdfhsfhsfghhsfhsfhf"
android:background="#drawable/customedittext"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/viewPagerIndicator"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="#dimen/_180sdp"
android:gravity="center">
<LinearLayout
android:id="#+id/viewPagerCountDots"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="horizontal" />
</RelativeLayout>
<com.information.aanjana.aanjanainformation.NonScrollGridView
android:id="#+id/gv_android"
android:layout_width="#dimen/_299sdp"
android:layout_height="match_parent"
android:horizontalSpacing="8dp"
android:layout_centerHorizontal="true"
android:numColumns="2"
android:paddingLeft="#dimen/_4sdp"
android:paddingRight="#dimen/_4sdp"
android:layout_marginTop="#dimen/_220sdp"
android:verticalSpacing="8dp"/>
</RelativeLayout>
</ScrollView>
<android.support.design.widget.NavigationView
android:id="#+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="#dimen/_170sdp"
android:layout_gravity="start"
app:menu="#menu/drawer"
/>
</android.support.v4.widget.DrawerLayout>
I want a edittext with navigation drawer which should be sticky and do not scroll with rest of the layout. How can I achive it.
What I want is explained in screenshot below:
Try my below code:
<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/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#ecedf1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="#dimen/_200sdp" />
<RelativeLayout
android:id="#+id/viewPagerIndicator"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="#dimen/_180sdp"
android:gravity="center">
<LinearLayout
android:id="#+id/viewPagerCountDots"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="horizontal" />
</RelativeLayout>
<com.information.aanjana.aanjanainformation.NonScrollGridView
android:id="#+id/gv_android"
android:layout_width="#dimen/_299sdp"
android:layout_height="match_parent"
android:horizontalSpacing="8dp"
android:layout_centerHorizontal="true"
android:numColumns="2"
android:paddingLeft="#dimen/_4sdp"
android:paddingRight="#dimen/_4sdp"
android:layout_marginTop="#dimen/_220sdp"
android:verticalSpacing="8dp"/>
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_200sdp"
android:layout_alignParentTop="true"
>
<EditText
android:layout_width="#dimen/_280sdp"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/_10sdp"
android:layout_height="#dimen/_40sdp"
android:text="fdgsdfhsfhsfghhsfhsfhf"
android:background="#drawable/customedittext"/>
</RelativeLayout>
</RelativeLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="#dimen/_170sdp"
android:layout_gravity="start"
app:menu="#menu/drawer"
/>
</android.support.v4.widget.DrawerLayout>
Here Only thing which I have changed is kept the editText outside the scrollView.
Why don't you try to put it out outside the ScrollView. Then just overlay it with a RelativeLayout and the gravity set to top. I can't run it now but in xml should look like something like 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/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#ecedf1">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="#dimen/_200sdp" />
<RelativeLayout
android:id="#+id/viewPagerIndicator"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginTop="#dimen/_180sdp"
android:gravity="center">
<LinearLayout
android:id="#+id/viewPagerCountDots"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="horizontal" />
</RelativeLayout>
<com.information.aanjana.aanjanainformation.NonScrollGridView
android:id="#+id/gv_android"
android:layout_width="#dimen/_299sdp"
android:layout_height="match_parent"
android:horizontalSpacing="8dp"
android:layout_centerHorizontal="true"
android:numColumns="2"
android:paddingLeft="#dimen/_4sdp"
android:paddingRight="#dimen/_4sdp"
android:layout_marginTop="#dimen/_220sdp"
android:verticalSpacing="8dp"/>
</RelativeLayout>
</ScrollView>
<!-- Here we add the layout outside the ScrollView -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_200sdp"
android:gravity="top"> <!-- GRAVITY ADJUST -->
<EditText
android:layout_width="#dimen/_280sdp"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/_10sdp"
android:layout_height="#dimen/_40sdp"
android:text="fdgsdfhsfhsfghhsfhsfhf"
android:background="#drawable/customedittext"/>
</RelativeLayout>
<android.support.design.widget.NavigationView
android:id="#+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="#dimen/_170sdp"
android:layout_gravity="start"
app:menu="#menu/drawer"
/>
</android.support.v4.widget.DrawerLayout>
Hopefully, it runs smoothly and turns out helpful.
How do I get my navigation drawer height to fill screen? As it is, it only wraps content. I want my navigation drawer to extend to the bottom but have the items in it to remain floating to the top.
Here is my activity layout
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
android:background="?attr/colorPrimary"/>
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:id="#+id/container"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:id="#+id/pane"/>
</LinearLayout>
<!-- The navigation drawer -->
<ListView
android:id="#+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#999"
android:dividerHeight="1dp"
android:background="#android:color/transparent"/>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
Here is my drawer 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="48dp"
android:paddingLeft="10dp"
android:paddingStart="10dp"
android:background="#color/drawer_background">
<ImageView
android:id="#+id/drawer_icon"
android:layout_width="32dp"
android:layout_height="32dp"
android:paddingBottom="2dp"
android:layout_gravity="bottom"
android:background="#android:color/transparent"/>
<TextView
style="#style/drawer_item"
android:id="#+id/drawer_item"
android:layout_gravity="bottom"
android:gravity="bottom"
android:maxLines="1"/>
</LinearLayout>