I am implementing a side menu which has Listview and Expandable listview and a button at the bottom. If the listview or expandable listview is big then button a the bottom is not visible. Listview and Expandable listview are scrolling individually. I want to scroll everything at the whole.
Where can I put the scrollview. In the Drawyerlayout or navigationview?
<?xml version="1.0" encoding="utf-8"?>
<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"
android:fitsSystemWindows="true"
tools:openDrawer="right">
<include
layout="#layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="#color/sidemenu_background"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:id="#+id/student_name_layout"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:id="#+id/stuent_name"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Student Name"
android:layout_marginLeft="10dp"
android:textColor="#color/white"
android:textSize="16sp"
tools:layout_editor_absoluteY="75dp"
tools:layout_editor_absoluteX="8dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/sidemenu_divider"
tools:layout_editor_absoluteY="75dp"
tools:layout_editor_absoluteX="64dp" />
</LinearLayout>
<ListView
android:id="#+id/list_menu_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#color/sidemenu_divider"
android:dividerHeight="1dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#color/sidemenu_divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ExpandableListView
android:id="#+id/dynamic_expandable_listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:childDivider="#color/sidemenu_divider"
android:groupIndicator="#null" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#color/sidemenu_divider" />
<android.support.constraint.ConstraintLayout
android:id="#+id/logout_view"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:paddingBottom="5dp"
android:paddingTop="5dp">
<TextView
android:id="#+id/logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="8dp"
android:text="#string/sign_out_text"
android:textColor="#color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="#+id/image"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.49"
android:layout_marginStart="15dp" />
<ImageView
android:id="#+id/image"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginLeft="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/logout_icon"
android:layout_marginStart="16dp" />
</android.support.constraint.ConstraintLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#color/sidemenu_divider" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
Related
I have an AppBar and other things in my layout. When the user scrolls down, I want AppBar(actually, the Toolbar to hide. This is what I have tried, the app bar isn't hiding all small part it just stays there. Actually I think the problem is with my header of the screen it gets collapsed and adds a small space when I scroll.
As you can see in second image some part stays it doesn't hide. I need to hide that part while scrolling.
Please provide me solution what am I doing wrong?
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleTextAppearance="#style/TextAppearance.AppCompat.Title"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:titleEnabled="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/slideIV"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/ic_dish" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/bottomButtonRL"
android:layout_gravity="bottom"
android:background="#drawable/gradient_bg" />
<View style="#style/itemBottomViewLarge" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_margin="#dimen/_20"
android:gravity="center_vertical"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="#drawable/fake_chef_bg"
app:civ_border_color="#color/border_grey_color"
app:civ_border_width="#dimen/_2" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="#dimen/_5"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/bold_font"
android:text="#string/fatima_al_zahraa"
android:textColor="#color/white"
android:textSize="#dimen/large_text_size"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:fontFamily="#font/regular_font"
android:text="#string/presenter_of_the_cuient"
android:textColor="#color/white"
android:textSize="#dimen/app_text_size" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:id="#+id/bottomButtonRL"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="#+id/slideIV"
android:layout_marginTop="-25dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="#dimen/_0"
android:layout_weight="1" />
<View
android:layout_width="match_parent"
android:layout_height="#dimen/_0"
android:layout_weight="1"
android:background="#color/defaultColor" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="#dimen/_20"
android:paddingLeft="#dimen/_20">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/ic_share" />
<RelativeLayout
android:layout_width="220dp"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/_10"
android:layout_marginLeft="#dimen/_10"
android:background="#drawable/ic_rec1">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="#font/regular_font"
android:gravity="center"
android:layout_centerInParent="true"
android:text="#string/add_to_fav"
android:textColor="#color/white"
android:textSize="#dimen/medium_text_size" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bottom_radius_view">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/regular_font"
android:padding="#dimen/_20"
android:text="#string/galetes_fires_au_plates_fires_au_plates_fires_au_plates_fires_au_plates_fires_au_plates"
android:textColor="#color/white"
android:textSize="#dimen/app_text_size" />
</LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.Toolbar
android:visibility="gone"
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
/>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="#dimen/_20"
android:paddingTop="#dimen/_10"
android:paddingRight="#dimen/_20">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/bold_font"
android:padding="#dimen/_5"
android:text="#string/les_videos"
android:textColor="#color/medium_grey_text_color"
android:textSize="#dimen/large_text_size" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/itemFRV"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_5" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
This is the header code:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="#dimen/header_height"
android:background="#color/white"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="#dimen/_20"
android:paddingRight="#dimen/_20">
<LinearLayout
android:id="#+id/backLL"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:gravity="center"
android:paddingRight="#dimen/_20"
android:layout_marginBottom="#dimen/_10"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/ic_back" />
</LinearLayout>
<ImageView
android:id="#+id/logoIV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:adjustViewBounds="true"
android:paddingStart="0dp"
android:paddingTop="#dimen/_15"
android:paddingEnd="#dimen/_10"
android:layout_marginBottom="#dimen/_10"
android:src="#drawable/ic_header_logo" />
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<ImageView
android:id="#+id/profileIV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:adjustViewBounds="true"
android:paddingStart="#dimen/_10"
android:paddingTop="#dimen/_15"
android:paddingEnd="0dp"
android:layout_marginBottom="#dimen/_10"
android:src="#drawable/ic_default_user" />
</LinearLayout>
</layout>
Answer to the problem is just remove
android:fitsSystemWindows="true"
Change the layout_scrollFlags
app:layout_scrollFlags="scroll|exitUntilCollapsed"
replace above line with
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
I'm using the following Activity layout.
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.drawerlayout.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.sothree.slidinguppanel.SlidingUpPanelLayout
android:id="#+id/sliding_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
app:panelHeight="0dp"
app:shadowHeight="0dp"
app:overlay="true" >
<RelativeLayout android:id="#+id/rootRelativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="#+id/location"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="#layout/activity_main_map" />
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:theme="#style/toolbarThemeFakeDark"
android:background="#drawable/trans_toolbar_bg"
android:layout_margin="16dp"
android:subtitle="test">
<ImageView
android:id="#+id/wordmark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="#drawable/wordmarkwhite"
android:contentDescription="#string/wordmark" />
</androidx.appcompat.widget.Toolbar>
<androidx.appcompat.widget.Toolbar android:id="#+id/timeBar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="#drawable/trans_toolbar_bg"
android:layout_marginBottom="24dp"
android:layout_alignParentBottom="true" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginStart="4dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="20dp" >
<SeekBar
android:id="#+id/maxTime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:progress="100"
android:hapticFeedbackEnabled="true"
android:layout_alignStart="#+id/timeNumber"
style="#style/MapSeekBar"
android:thumb="#drawable/map_seekbar_thumb" />
<TextView android:id="#+id/timeNumber"
android:background="#drawable/map_seekbar_thumb"
android:gravity="center"
android:layout_width="32dp"
android:layout_height="32dp"
android:textColor="#color/cpb_grey"
android:layout_marginStart="8dp"
android:layout_marginTop="0dp" />
</RelativeLayout>
</androidx.appcompat.widget.Toolbar>
</RelativeLayout>
<!--- Where all the fragments live -->
<FrameLayout
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="20dp"/>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
<fragment android:name="com.myapp.FragmentLeftPanel"
android:id="#+id/left_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:maxWidth="400dp"
/>
<fragment android:name="com.myapp.FragmentFilterPanel"
android:id="#+id/right_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="end"
/>
</androidx.drawerlayout.widget.DrawerLayout>
<FrameLayout android:id="#+id/cluster_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="20dp"/>
<FrameLayout android:id="#+id/cluster_event_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="20dp"/>
<FrameLayout android:id="#+id/create_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="20dp"/>
And the following fragment layout.
The fragment gets loaded into the "fragment_container" node of the activity layout.
<View android:id="#+id/backgroundColor"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/app_light_background"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="fill_parent">
<FrameLayout
android:id="#+id/commentFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="40dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="4dp"
android:layout_marginRight="16dp"
android:background="#color/app_light_background" >
<LinearLayout
android:id="#+id/textBox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|bottom|end"
android:measureWithLargestChild="true"
android:orientation="horizontal">
<ImageView
android:id="#+id/attachButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:elevation="1dp"
android:paddingStart="1dp"
android:paddingEnd="10dp"
android:contentDescription="Attach Picture"
app:srcCompat="#android:drawable/ic_menu_camera" />
<EditText
android:id="#+id/commentBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:layout_weight="1"
android:ems="10"
android:hint="Comment"
android:inputType="text|textCapSentences|textMultiLine"
android:maxHeight="70dp"
android:autofillHints=""
android:textColor="#color/app_light_primary_text" />
<ImageView
android:id="#+id/sendButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:clickable="true"
android:focusable="true"
android:paddingStart="24dp"
android:paddingTop="8dp"
android:paddingEnd="8dp"
android:paddingBottom="8dp"
android:contentDescription="Post Comment"
android:tint="#color/app_light_primary_frame"
android:src="#drawable/ic_send_grey600_36dp" />
</LinearLayout>
</FrameLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#+id/commentFrame"
android:clickable="true"
android:focusable="true"
android:gravity="center_horizontal"
android:orientation="vertical">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="#+id/commentRefresh"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:id="#+id/commentList"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#color/app_light_background"
android:clickable="true"
android:focusable="true" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="#dimen/shadow_height"
android:layout_above="#+id/commentFrame"
android:background="#drawable/above_shadow" />
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:theme="#style/toolbarThemeFakeDark">
</androidx.appcompat.widget.Toolbar>
</RelativeLayout>
<View android:id="#+id/backPart"
android:layout_width="match_parent"
android:layout_height="100dip"
android:clickable="true"
android:focusable="true"
android:visibility="gone" />
<View android:id="#+id/dragPart"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:focusable="true"
android:layout_below="#+id/backPart"
android:layout_alignParentStart="true" />
My problem is the "commentBox" field in the fragment. When you tap on it, the virtual keyboard comes up over the top of the bottom half of the fragment content instead of pushing the content up. So you cannot see the text field as you type.
I've been searching and trying recommendations for days, such as using "android:windowSoftInputMode=adjustPan" or some variant. But none of them have had any effect.
What could be preventing the keyboard from pushing up the content of the Activity in this instance?
Add android:windowSoftInputMode="stateAlwaysHidden|adjustResize" to the activity in your manifest file
And then add android:fitsSystemWindows="true" in your rootLayout(not the EditText)
I'm adding a BottomNavigationView to My MainActivity
at first show nothing wrong but after click on other items, BottomNavigationView strangely moving up and down. In other projects, I had never this problem and I don't know why I am getting this:
p.s: In default fragment (which is first at right in screenshot) I have a content but in other fragments, I have no content.
Here is my MainActivity 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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.activity.MainActivity">
<FrameLayout
android:id="#+id/MainActivity_FrameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/MainActivity_BottomView" />
<android.support.design.widget.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/colorPrimary"
app:menu="#menu/main_bottom_view_menu"
app:elevation="2dp"
app:itemTextColor="#android:color/white"
app:itemIconTint="#android:color/white"
android:id="#+id/MainActivity_BottomView"/>
</RelativeLayout>
and here is the screenshot of how does shown
after clicking on another item
and when select default item again
--- EDIT ---
I realized it's happen when use CoordinatorLayout , AppBarLayout and CollapsingToolbarLayout in fragment . After remove that lines app work without any problem .
Here is my fragment Layout :
<android.support.design.widget.CoordinatorLayout 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="#e2e2e2"
android:animateLayoutChanges="true"
android:fitsSystemWindows="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.fragment.MainFragments.ProfileFragment">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:background="#color/colorPrimaryDark"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimaryDark"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
app:titleEnabled="false"
app:scrimAnimationDuration="300"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:background="#color/colorPrimaryDark"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="140dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:id="#+id/Profile_InfoContainer"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content">
<com.graymind.applog.customview.CircleImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="#+id/Profile_ProfilePhoto"
android:layout_marginTop="10dp"
android:scaleType="centerCrop"
app:srcCompat="#drawable/login_bg"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:textColor="#android:color/white"
android:gravity="center"
android:id="#+id/Profile_FullName"
android:text="FullName"
android:textStyle="bold"/>
<TextView
android:id="#+id/Profile_Id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="'#gray_mind75"
android:textColor="#android:color/white"
android:textStyle="normal" />
</LinearLayout>
<TextView
android:id="#+id/Profile_Bio"
android:layout_width="match_parent"
android:layout_below="#+id/Profile_InfoContainer"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:layout_marginBottom="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textSize="12sp"
android:lineSpacingExtra="4sp"/>
android:textColor="#android:color/white"
android:textDirection="rtl" />
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:weightSum="3"
android:layout_below="#+id/Profile_Bio"
android:layout_height="50dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp"
android:weightSum="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:text="1234"
android:textColor="#android:color/white"
android:textSize="#dimen/profile_stats_texts_size"
android:gravity="center"
tools:ignore="NestedWeights" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:textSize="#dimen/profile_stats_texts_size"
android:textColor="#android:color/white"
android:gravity="center"
android:text="#string/post"/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/colorPrimary"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp"
android:weightSum="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:text="1234"
android:textSize="#dimen/profile_stats_texts_size"
android:textColor="#android:color/white"
android:gravity="center"
tools:ignore="NestedWeights" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:textColor="#android:color/white"
android:textSize="#dimen/profile_stats_texts_size"
android:gravity="center"
android:text="#string/followings"/>
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/colorPrimary"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:padding="5dp"
android:weightSum="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:text="1234"
android:textSize="#dimen/profile_stats_texts_size"
android:textColor="#android:color/white"
android:gravity="center"
tools:ignore="NestedWeights" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:textSize="#dimen/profile_stats_texts_size"
android:textColor="#android:color/white"
android:gravity="center"
android:text="#string/followers"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
app:layout_collapseMode="pin"
android:layout_height="?attr/actionBarSize">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="#string/profile"
android:gravity="center"
android:layout_toStartOf="#+id/Profile_ToolbarProfileIcon"
android:textColor="#android:color/white"
android:layout_marginEnd="10dp"/>
<ImageView
android:layout_width="30dp"
android:layout_marginEnd="10dp"
android:padding="5dp"
android:id="#+id/Profile_ToolbarProfileIcon"
android:layout_height="match_parent"
app:srcCompat="#drawable/ic_profile"
android:tint="#android:color/white"
android:layout_alignParentEnd="true"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:id="#+id/ProfilePostsScrollView"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:requiresFadingEdge="none"
android:id="#+id/Profile_PostsRecycler"/>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Thanks in advance for your guidance.
Change your root layout to LinearLayout like below:
<?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.activity.MainActivity">
<FrameLayout
android:id="#+id/MainActivity_FrameLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<android.support.design.widget.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
app:menu="#menu/main_bottom_view_menu"
app:elevation="2dp"
app:itemTextColor="#android:color/white"
app:itemIconTint="#android:color/white"
android:id="#+id/MainActivity_BottomView" />
</LinearLayout>
Hi I have a two recyclerView with one bottom view. When i click an item in recyclerView a popup window with editText should come. When i touch an editText the keyboard is triggered, the linear layout gets pushed up. I don't want to push up the layout the keyboard should visible above the screen.
XML code
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/relative_layout"
android:orientation="vertical">
<include layout="#layout/app_toolbar" />
<View
android:layout_width="match_parent"
android:layout_height="#dimen/margin_1dp"
android:background="#color/black_color_10_percent" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/black_color_2_percent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/tool_tip_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#color/color_white"
android:gravity="center_vertical"
android:padding="5dp">
<TextView
android:id="#+id/text_view_user_tool_tip_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="#dimen/margin_10dp"
android:layout_toLeftOf="#+id/image_view_remove_tool_tip"
android:gravity="center|left"
android:singleLine="true"
android:textColor="#color/icon_un_selected_color"
android:textSize="#dimen/text_size_12dp" />
<ImageView
android:id="#+id/image_view_remove_tool_tip"
android:layout_width="#dimen/margin_24dp"
android:layout_height="#dimen/margin_24dp"
android:layout_alignParentRight="true"
android:layout_gravity="right|center_vertical"
android:layout_marginRight="#dimen/margin_10dp"
android:background="#drawable/circle_grey_bg"
android:padding="#dimen/margin_6dp"
android:src="#drawable/ic_close_white_24dp" />
</RelativeLayout>
<android.support.v7.widget.CardView
android:id="#+id/card_view_your_suggestions"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
app:cardBackgroundColor="#color/light_grey_color"
app:cardCornerRadius="0dp"
app:cardElevation="0.5dp"
app:cardMaxElevation="1dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true"
app:contentPaddingBottom="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="#dimen/margin_40dp"
android:background="#color/color_grey"
android:gravity="center|left"
android:paddingLeft="#dimen/margin_12dp"
android:text="#string/text_your_selections"
android:textColor="#color/black_color_87_percent"
android:textSize="#dimen/text_size_14dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view_your_selection_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" />
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/card_view_suggestions"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="#dimen/margin_6dp"
android:layout_weight="3"
android:background="#android:color/white"
app:cardCornerRadius="0dp"
app:cardElevation="0dp"
app:cardMaxElevation="1dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true"
app:contentPaddingBottom="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="#dimen/margin_40dp"
android:background="#color/color_grey"
android:gravity="center|left"
android:paddingLeft="#dimen/margin_12dp"
android:text="#string/text_your_suggestions"
android:textColor="#color/black_color_87_percent"
android:textSize="#dimen/text_size_14dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view_your_suggestion_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:fadeScrollbars="false"
android:scrollbarThumbVertical="#drawable/scrollbar_thumb"
android:scrollbarTrackVertical="#drawable/scrollbar_track"
android:scrollbars="vertical" />
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="#dimen/margin_8dp"
android:layout_weight="1.1"
android:visibility="gone"
app:cardBackgroundColor="#color/light_grey_color"
app:cardCornerRadius="0dp"
app:cardElevation="0dp"
app:cardMaxElevation="1dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true"
app:contentPaddingBottom="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="#dimen/margin_40dp"
android:background="#color/colorPrimaryDark"
android:gravity="center|left"
android:paddingLeft="#dimen/margin_12dp"
android:text="#string/text_add_new"
android:textColor="#color/black_color_87_percent"
android:textSize="#dimen/text_size_14dp" />
<abihealth.emrappabi.widgets.MyCustomTextView
android:id="#+id/text_view_add_new_element"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="#dimen/margin_8dp"
android:background="#drawable/edit_text_bg"
android:maxLines="1"
android:paddingLeft="#dimen/margin_8dp" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:id="#+id/relative_layout"
android:layout_width="match_parent"
android:layout_height="#dimen/margin_40dp"
android:layout_alignParentBottom="true"
android:background="#color/color_grey">
<LinearLayout
android:id="#+id/add_new_phrase_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="#dimen/margin_6dp"
android:background="#android:color/white"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/margin_6dp"
android:src="#drawable/icon_add_drawable" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|left"
android:paddingLeft="#dimen/margin_2dp"
android:text="#string/text_add_phrase"
android:textColor="#color/black_54_percent"
android:textSize="#dimen/text_size_14dp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
Add to your activity in manifest , this works for me
<activity
...
android:windowSoftInputMode="adjustNothing">
</activity>
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