I've got a problem with Expandable Layout (https://android-arsenal.com/details/1/2456).
When the app starts, the fragment is inserted in #id(flContent), ExpandableRelativeLayout is collapsed (because of app:ael_expanded="false") and I can expand and collapse this with a click on #id/cerca_button_advanced.
When, with the menu in NavigationView, I load another fragment and then again the first one, the ExpandableRelativeLayout still expanded.
Why does it still expanded, even if app:ael_expanded="false"? I hope someone can help me...
This is the activity_main.xml
<!-- This DrawerLayout has two children at the root -->
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<!-- This LinearLayout represents the contents of the screen -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- The ActionBar displayed at the top -->
<include
layout="#layout/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<!-- The main content view where fragments are loaded -->
<FrameLayout
android:id="#+id/flContent"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
<!-- The navigation drawer that comes from the left -->
<!-- Note that `android:layout_gravity` needs to be set to 'start' -->
<android.support.design.widget.NavigationView
android:id="#+id/nvView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#android:color/white"
app:headerLayout="#layout/nav_header"
app:menu="#menu/drawer_view"/>
</android.support.v4.widget.DrawerLayout>
This is the fragment.xml inserted in #id/flContent
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginEnd="5dp"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
card_view:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<TableLayout
android:id="#+id/cerca_tabella"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shrinkColumns="1"
android:stretchColumns="1">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/cerca_testo_nome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:labelFor="#+id/cerca_input_nome"
android:text="#string/cerca_descrizione_nome"/>
<EditText
android:id="#+id/cerca_input_nome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:inputType="textNoSuggestions|textCapSentences|text"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/cerca_testo_via"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:labelFor="#+id/cerca_input_via"
android:text="#string/cerca_descrizione_indirizzo"/>
<EditText
android:id="#+id/cerca_input_via"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:inputType="textNoSuggestions|text|textPostalAddress"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/cerca_testo_citta"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:labelFor="#+id/cerca_input_citta"
android:text="#string/cerca_descrizione_citta"/>
<Spinner
android:id="#+id/cerca_spinner_citta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:entries="#array/cerca_citta"/>
</TableRow>
</TableLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<RelativeLayout
android:id="#+id/cerca_button_advanced"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:id="#+id/cerca_button_advance_logo"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignParentStart="true"
android:layout_marginEnd="5dp"
android:layout_marginStart="5dp"
android:background="#drawable/triangolo"
/>
<TextView
android:id="#+id/cerca_button_advance_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/cerca_button_advance_logo"
android:layout_toEndOf="#+id/cerca_button_advance_logo"
android:text="Advanced"
/>
</RelativeLayout>
<com.github.aakira.expandablelayout.ExpandableRelativeLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/expandable_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/cerca_button_advanced"
app:ael_duration="500"
app:ael_expanded="false"
app:ael_interpolator="decelerate"
app:ael_orientation="vertical">
<Switch
android:id="#+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Switch 1"/>
<Switch
android:id="#+id/switch2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/switch1"
android:text="New Switch 2"/>
</com.github.aakira.expandablelayout.ExpandableRelativeLayout>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<my.AdapterLinearLayout
android:id="#+id/cerca_linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical"/>
</LinearLayout>
</ScrollView>
Related
I have a problem when create bottomsheet in android (look likes google maps)
when i come to maps ui,but bottom sheet does not hide
Expectation: Click on marker and appear the bottom sheet likes google maps
Here is my xml :
<?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:orientation="vertical"
tools:context="com.example.dangquang.stackexchange.activity.MapActivity">
<android.support.v7.widget.Toolbar
android:id="#+id/actMap_Toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:titleTextColor="#android:color/white">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/title_maps"
android:textSize="#dimen/title_nav_toolbar" />
</android.support.v7.widget.Toolbar>
<android.support.v7.widget.Toolbar
android:id="#+id/actMap_tbDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/actMap_tvDuration"
style="#style/title_detail_direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="#drawable/duration_icon" />
<TextView
android:id="#+id/actMap_tvDistance"
style="#style/title_detail_direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="#drawable/distance_icon" />
<Spinner
android:id="#+id/actMap_spnMode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<TextView
android:id="#+id/actMap_tvDirection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/_5sdp"
android:textColor="#android:color/white"
android:textSize="#dimen/_14sdp" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
<EditText
android:id="#+id/actMap_etSearch"
style="#style/action_searchMap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/place_autocomplete_search_hint"
android:imeOptions="actionSearch"
android:inputType="text" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="#+id/actMap_frgMaps"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
>
<android.support.v4.widget.NestedScrollView
android:id="#+id/actMap_BottomSheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/actMap_tvDetailName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="#dimen/item_title_size"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/actMap_tvDetailPoint"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
<TextView
android:id="#+id/actMap_tvDetailDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="#drawable/car_icon"
style="#style/navigation_item_text" />
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
</FrameLayout>
</LinearLayout>
You can set bottomsheet invisible on onCreate with this actMap_BottomSheet.setVisibility(View.INVISIBLE) and make it visible whenever you want.
But your xml is so complex and has so many nested levels which causes to performance issues. I suggest you to use constraint layout.
I created a Basic-Activity and have the activity_main which includes the content_main. But at the Design-Screen I can see, that the included content_main starts below the toolbar and ends behind the navigationbar. I think that the Included layout is as high as the full screen and not as high as the space between toolbar and the end of screen. What can I do?
Screenshot of Designscreen
Activity_Main
<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"
tools:context="com.htlhl.kellergassen_app.MainActivity"
android:fitsSystemWindows="true">
<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="#color/KG_orange">
<android.support.v7.widget.AppCompatTextView
android:id="#+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/HomeActivity"
style="#style/Toolbartitle_KG" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_main" />
</android.support.design.widget.CoordinatorLayout>
Content_Main
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/background2"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.htlhl.kellergassen_app.MainActivity"
tools:showIn="#layout/activity_main"
android:id="#+id/rl_main">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="false"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:orientation="vertical"
android:onClick="here">
<ImageView
android:id="#+id/Kellergassenlogo"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="0dp"
android:contentDescription="#string/ButtonKellergasse"
android:onClick="toKellerkatze"
android:src="#drawable/kk_logo" />
<Button
android:id="#+id/btnToKellergasse"
android:layout_width="180dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:background="#drawable/roundbutton"
android:onClick="toKellerkatze"
android:text="#string/ButtonKellergasse"
android:textColor="#color/white"
android:textSize="15sp" />
<ImageView
android:id="#+id/Routenlogo"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="top|bottom|center_horizontal"
android:layout_marginTop="15dp"
android:contentDescription="#string/ButtonRoute"
android:onClick="toRouten"
android:src="#drawable/routenlogo" />
<Button
android:id="#+id/btnToRouten"
android:layout_width="180dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:background="#drawable/roundbutton"
android:onClick="toRouten"
android:text="#string/ButtonRoute"
android:textColor="#color/white"
android:textSize="15sp" />
</LinearLayout>
<Button
android:id="#+id/btnParse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="parse"
android:textColor="#color/black"
android:background="#color/KG_green"
android:onClick="startParsing"/>
<LinearLayout
android:id="#+id/layout_bottom_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginStart="10dp"
android:layout_weight="2"
android:gravity="center"
android:orientation="vertical">
<fragment
android:id="#+id/fragmentChooseLang"
android:name="com.htlhl.kellergassen_app.FragmentLanguage"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/tvChooseLang"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:drawableTop="#drawable/german_flag"
android:text="#string/chooseLanguage"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<Button
android:id="#+id/btnToImpressum"
style="?android:attr/borderlessButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/ButtonImpressum"
android:textSize="15sp"
android:textStyle="bold"
android:layout_gravity="bottom"/>
</LinearLayout>
</RelativeLayout>
The Layout named "layout_bootom_main" is not shown, because it is layout_alignParentBottom and the parents end is out of screen.
You can add scroll view in content_main as parent view for both linear layouts.
<RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Add your linear layouts here -->
</LinearLayout>
</ScrollView>
</RelativeLaout>
And while designing in android studio try to preview the design with device having more hight
You could wrap everything inside a scrollview like this:
<RelativeLayout
......>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<-! All the layout children in here-->
</ScrollView>
</RelativeLaout>
While I open the drawer the toolbar's colors turns way more darker than the color of the rest of the screen.
Initially Toolbar's background color is white. Any ideas why this is happening ?
The code I'm using is below :
<android.support.v4.widget.DrawerLayout
android:id="#+id/dl_poll_container"
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:background="#color/white"
android:layout_width="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="false">
<LinearLayout android:id="#+id/ll_toolbar_container"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar android:id="#+id/tb_poll_toolbar"
android:gravity="center"
android:layout_width="match_parent" android:layout_height="wrap_content">
<TextView
android:id="#+id/tv_poll_toolbar_title"
android:gravity="center" android:layout_gravity="center"
android:textSize="#dimen/text_size_xxxlarge" android:fontFamily="sans-serif"
android:textColor="#color/black" tools:text="My Title"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
</android.support.v7.widget.Toolbar>
</LinearLayout>
<FrameLayout android:background="#color/white"
android:layout_marginTop="?attr/actionBarSize"
android:layout_width="match_parent" android:layout_height="wrap_content">
<android.support.v4.view.ViewPager
android:id="#+id/vp_poll_viewpager"
android:background="#color/white"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="48dp"
android:background="#drawable/background_line"
android:layout_width="144dp" android:layout_height="wrap_content">
<FrameLayout android:layout_width="36dp" android:layout_height="36dp"
android:layout_alignParentLeft="true">
<ImageView
android:id="#+id/pager_img_one"
android:layout_width="36dp" android:layout_height="36dp"
android:scaleType="centerInside"
app:srcCompat="#drawable/ic_active_nav" />
<TextView android:id="#+id/tv_poll_one"
android:textStyle="bold"
android:text="1" android:gravity="center"
android:textColor="#color/white"
android:layout_width="36dp" android:layout_height="36dp" />
</FrameLayout>
<FrameLayout android:layout_width="36dp" android:layout_height="36dp"
android:layout_centerInParent="true">
<ImageView
android:id="#+id/pager_img_two"
android:layout_width="36dp" android:layout_height="36dp"
android:scaleType="centerInside"
app:srcCompat="#drawable/ic_deactive_nav" />
<TextView android:id="#+id/tv_poll_two"
android:visibility="invisible" android:textStyle="bold"
android:text="2" android:gravity="center"
android:textColor="#color/white"
android:layout_width="36dp" android:layout_height="36dp" />
</FrameLayout>
<FrameLayout android:layout_width="36dp" android:layout_height="36dp"
android:layout_alignParentRight="true">
<ImageView
android:id="#+id/pager_img_three"
android:layout_width="36dp" android:layout_height="36dp"
android:scaleType="centerInside"
app:srcCompat="#drawable/ic_deactive_nav" />
<TextView android:id="#+id/tv_poll_three"
android:visibility="invisible" android:textStyle="bold"
android:text="3" android:gravity="center"
android:textColor="#color/white"
android:layout_width="36dp" android:layout_height="36dp" />
</FrameLayout>
</RelativeLayout>
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent" android:layout_height="wrap_content">
<LinearLayout android:id="#+id/pb_container"
android:layout_width="match_parent" android:layout_height="8dp"
android:background="#android:color/transparent"
android:gravity="bottom">
<ProgressBar android:id="#+id/progress_bar"
style="#style/Widget.AppCompat.ProgressBar.Horizontal"
android:progressDrawable="#drawable/progress_bar_drawable"
android:indeterminate="false"
android:max="100" android:progress="0"
android:layout_width="match_parent" android:layout_height="8dp" />
</LinearLayout>
<TextView android:text="Uploading Video Progress"
android:textColor="#color/app_body_text_3" android:gravity="center_horizontal"
android:layout_width="match_parent" android:layout_height="wrap_content" />
</LinearLayout>
</FrameLayout>
<android.support.design.widget.NavigationView
android:id="#+id/nv_poll_navigation"
android:background="#color/white"
android:layout_width="wrap_content" android:layout_height="match_parent"
android:fitsSystemWindows="false" android:layout_gravity="start" />
DrawerLayout should have two children: the main content view and the navigation drawer.
https://developer.android.com/training/implementing-navigation/nav-drawer.html#DrawerLayout
So you should wrap the main content with FrameLayout like this:
<android.support.v4.widget.DrawerLayout
android:id="#+id/dl_poll_container"
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:background="#color/white"
android:layout_width="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="false">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:id="#+id/ll_toolbar_container"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_height="wrap_content">
...
</LinearLayout>
<FrameLayout android:background="#color/white"
android:layout_marginTop="?attr/actionBarSize"
android:layout_width="match_parent" android:layout_height="wrap_content">
....
</FrameLayout>
</FrameLayout>
<android.support.design.widget.NavigationView
android:id="#+id/nv_poll_navigation"
android:background="#color/white"
android:layout_width="wrap_content" android:layout_height="match_parent"
android:fitsSystemWindows="false" android:layout_gravity="start" />
</android.support.v4.widget.DrawerLayout>
There is a method in the DrawerLayout named setScrimColor with a default value (some kind of transparent dark grey).
You can use that method to change the color that is drawn on top of the content when the drawer is opened. You can set it to fully transparent if needed
I want to make sliding panel from bottom like Google Play Music so i am using Umano Library but View pager inside the main content not scrollable. Please help me out.
I have view Pager which loads data from server and set in recycler view but the view pager tabs not scrolling and the sliding layout data not showing.
<com.sothree.slidinguppanel.SlidingUpPanelLayout
xmlns:app="http://schemas.android.com/tools"
xmlns:sothree="http://schemas.android.com/apk/res-auto"
android:id="#+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
sothree:umanoDragView="#+id/dragView"
sothree:umanoOverlay="true"
sothree:umanoPanelHeight="68dp"
sothree:umanoParallaxOffset="100dp"
sothree:umanoShadowHeight="4dp">
<!-- MAIN CONTENT -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<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.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="false" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/menu_item_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</FrameLayout>
<!-- SLIDING LAYOUT -->
<LinearLayout
android:id="#+id/dragView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:clickable="true"
android:focusable="false"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/rllayout1"
android:layout_width="match_parent"
android:layout_height="68dp"
android:background="#android:color/holo_green_dark"
android:orientation="horizontal">
<ImageView
android:id="#+id/cart_icon"
android:layout_width="0dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:layout_weight="0.5"
android:padding="2dp"
android:src="#drawable/cart_icon" />
<LinearLayout
android:id="#+id/rllayout2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
android:layout_weight="2"
android:gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="#+id/no_of_items"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:text="quiz_name" />
<TextView
android:id="#+id/item_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:text="quiz_name" />
<TextView
android:id="#+id/taxes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:text="plus taxes" />
</LinearLayout>
<Button
android:id="#+id/btnCheckOut"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#android:color/holo_green_light"
android:gravity="center_vertical|right"
android:padding="#dimen/padding_10dp"
android:text="Check Out" />
</LinearLayout>
<include layout="#layout/sliding_panel_layout"></include>
</LinearLayout>
Sliding_panel_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.satkarrestro.classes.AutoResizeTextView
android:id="#+id/tv1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/holo_green_dark"
android:gravity="center"
android:text="Ready to Proceed"
android:textColor="#FFFFFF"
android:textSize="#dimen/text_size_15sp" />
<com.satkarrestro.classes.AutoResizeTextView
android:id="#+id/tvCategoryName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/tv1"
android:padding="#dimen/padding_10dp"
android:text="abcdef"
android:textSize="#dimen/text_size_10sp" />
<ListView
android:id="#+id/list_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"></ListView>
<TableLayout
android:id="#+id/tbSum"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TableLayout>
I am using a CoordinatorLayout with RecyclerView.The app runs fine but my problem is the the view should only scroll as the items in RecyclerView.In my case i have only 3 items but the CordinatorLayout will scroll the RecyclerView till it will snap to the top because of this i am getting the below part as white as the listsize is only 3.
XMl
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<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.support.design.widget.AppBarLayout
android:id="#+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="#android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView38"
android:layout_alignParentTop="true"
android:padding="20dp"
android:src="#drawable/ic_filter_back" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/rv_event_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#fff"
android:orientation="horizontal"
android:paddingBottom="03dp">
<RelativeLayout
android:id="#+id/rl_tab1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="#+id/tab1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="05dp"
android:src="#drawable/ic_create_wedding_admin" />
<TextView
android:id="#+id/tv_tab_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tab1"
android:layout_marginLeft="05dp"
android:layout_marginRight="05dp"
android:gravity="center"
android:text="Admin" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_tab2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="#+id/tab2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="05dp"
android:src="#drawable/ic_create_wedding_guests" />
<TextView
android:id="#+id/tv_tab_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tab2"
android:layout_marginLeft="05dp"
android:layout_marginRight="05dp"
android:gravity="center"
android:text="Guests" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_ed_tab_guests"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="#+id/iv_ed_iv_budget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="05dp"
android:src="#drawable/ic_create_wedding_budget" />
<TextView
android:id="#+id/tvbud"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/iv_ed_iv_budget"
android:layout_marginLeft="05dp"
android:layout_marginRight="05dp"
android:gravity="center"
android:text="Budget" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_ed_tab_tasks"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="#+id/iv_ed_iv_tasks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="05dp"
android:src="#drawable/ic_create_wedding_tasks" />
<TextView
android:id="#+id/tv_ed_tasks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/iv_ed_iv_tasks"
android:layout_marginLeft="05dp"
android:layout_marginRight="05dp"
android:gravity="center"
android:text="Tasks" />
</RelativeLayout>
</LinearLayout>
What i want is to scroll the view only till the item size.
This issue has already been brought up.
Please check other questions before posting another.
You need to provide a custom behavior to your child layout in the Coordinator Layout.
Check this if it helps:
https://stackoverflow.com/a/33461064/2346980