I have created a recycler view containing a list of items , for example options like Home, contacts profile with the help of Adapter in my FragmentA class. so currently on clicking each of the items in recycler view, I'm opening a fragment above the Fragment A. so once the fragment is opened, I have to show a blur background below the opened Fragment, so that the items in FragmentA can be slightly visible and once the user clicks the blur view , they have to close the opened fragment also. How can we blur the view and close the Fragment by clicking on the blurview??
sample code for fragmentA layout, where I'm adding the newly opened fragment into the filter_pop_up_frame_lyt which shows above the Main Fragment A
<?xml version="1.0" encoding="utf-8"?>
<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:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<LinearLayout
android:id="#+id/dot_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/drawer_layout"
android:layout_centerInParent="true"
android:elevation="50dp"
android:gravity="center">
<androidx.core.widget.NestedScrollView
android:id="#+id/scrollView_lyt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/tastry_btn_txt"
android:isScrollContainer="false"
android:visibility="visible">
<RelativeLayout
android:id="#+id/root_lyt_click"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<LinearLayout
android:id="#+id/filter_container_lyt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/toolbar"
android:layout_marginTop="2dp"
android:background="#495471"
android:gravity="center_vertical"
android:orientation="vertical">
<LinearLayout
android:id="#+id/filter_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/toolbar"
android:layout_margin="15dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:src="#drawable/filter">
</ImageView>
<TextView
android:id="#+id/filter_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:fontFamily="sans-serif-medium"
android:text="Filter By"
android:textColor="#color/white"
android:textSize="22dp"
android:textStyle="normal" />
</LinearLayout>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
app:tabTextAppearance="#android:style/TextAppearance.Widget.TabWidget"
android:layout_marginLeft="3dp">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recycler_view_filter_category"
android:layout_width="wrap_content"
app:tabTextAppearance="#android:style/TextAppearance.Widget.TabWidget"
android:layout_height="wrap_content" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>
<FrameLayout
android:id="#+id/filter_pop_up_frame_lyt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/filter_container_lyt"
android:elevation="5dp">
</FrameLayout>
<com.google.android.material.navigation.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/palate_survey_bg"
android:fitsSystemWindows="true"
app:headerLayout="#layout/header"
app:itemIconSize="20dp"
app:itemIconTint="#color/white"
app:itemTextColor="#color/white"
app:menu="#menu/drawermenu" />
</androidx.drawerlayout.widget.DrawerLayout>
SampleCode for the Fragment to be opened Above the MainFragment:
<?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:id="#+id/linear_layout_root_price_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- android:background="#drawable/filter_bg_round_corner"-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/filter_bg_round_corner"
android:orientation="vertical">
<LinearLayout
android:id="#+id/progress_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="vertical">
<com.google.android.material.slider.RangeSlider
android:id="#+id/filter_price_ranger_Slider"
style="#style/Theme.TastrySampleApp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressDrawable="#drawable/progress_layout_bg"
android:stepSize="1"
android:theme="#style/Theme.TastrySampleApp"
android:valueFrom="0.0"
android:valueTo="100.0"
app:labelBehavior="gone"
app:thumbColor="#01b0c3"
app:tickVisible="false"
app:values="#array/initial_slider_values" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/onStartTrackingTouch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="9dp"
android:ellipsize="end"
android:maxLines="1"
android:text="$0"
android:textColor="#color/black"
android:textSize="16sp">
</TextView>
<TextView
android:id="#+id/onStopTrackingTouch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:ellipsize="end"
android:maxLines="1"
android:text="$100+"
android:textColor="#color/black"
android:textSize="16sp">
</TextView>
</RelativeLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginTop="20dp"
android:background="#99a3bc">
</View>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:gravity="right"
android:orientation="horizontal"
android:padding="14dp">
<TextView
android:id="#+id/filter_price_wine_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:text="1234"
android:textColor="#color/black"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone">
</TextView>
<TextView
android:id="#+id/filter_price_wine_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_weight="0"
android:ellipsize="end"
android:maxLines="1"
android:text="Wines"
android:textColor="#color/black"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone">
</TextView>
<View
android:layout_width="0dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:layout_weight="1" />
<LinearLayout
android:id="#+id/filter_price_root_clear_lyt"
android:layout_width="110dp"
android:layout_height="35dp"
android:layout_gravity="center"
android:layout_marginLeft="50dp"
android:layout_toLeftOf="#+id/filter_price_Apply"
android:background="#drawable/filter_clear_bg"
android:gravity="center"
android:visibility="gone">
<ImageView
android:id="#+id/close_filter_price"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:src="#drawable/close_white">
</ImageView>
<TextView
android:id="#+id/clear_price_filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginTop="3dp"
android:layout_toRightOf="#id/close_filter_price"
android:text="Clear All"
android:textStyle="bold"
android:textColor="#f2faff">
</TextView>
<TextView
android:id="#+id/price_clear_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="3dp"
android:layout_toRightOf="#id/clear_price_filter"
android:textStyle="bold"
android:textColor="#f2faff">
</TextView>
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="#+id/filter_price_Apply"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:background="#drawable/filter_apply_bg"
android:gravity="center"
android:text="Apply"
android:textAllCaps="false"
android:textColor="#f2faff"
android:textSize="12sp"
android:visibility="gone">
</com.google.android.material.button.MaterialButton>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Related
Hello I am trying to add a ScrollView in my project.
The purpose is that I will be putting multiple CardViews in the middle of my project.
It is within a Relative Layout. With a Linear Layout on the top portion. But also having a BottomNavigation at the bottom. Which I would like for it to be fixed and not scrolling.
Here is the 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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".Bottom_Nav"
android:fillViewport="true"
android:background="#drawable/bg7">
<LinearLayout
android:id="#+id/titlemenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/pacifico_regular"
android:text="Menu"
android:textColor="#6E2C00"
android:textSize="50dp"
android:textStyle="bold"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/carterone_regular"
android:text="View Our Seelction!"
android:textColor="#6E2C00"
android:textSize="20dp"
android:textStyle="bold"
android:layout_gravity="center"/>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/titlemenu"
android:layout_above="#id/bottom_navigation">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<androidx.cardview.widget.CardView
android:id="#+id/hot"
android:layout_width="320dp"
android:layout_height="match_parent"
app:cardCornerRadius="15dp"
android:layout_marginTop="10dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#EB984E"
android:padding="10dp">
<TextView
android:id="#+id/t1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:fontFamily="#font/carterone_regular"
android:text="Cold Drinks"
android:textColor="#6E2C00"
android:textSize="30dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/t1"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:fontFamily="#font/carterone_regular"
android:text="Cool Off With Our Cold Bevs!"
android:textStyle="bold" />
<ImageView
android:layout_width="116dp"
android:layout_height="82dp"
android:layout_alignParentRight="true"
android:layout_marginRight="-31dp"
android:maxHeight="200dp"
android:src="#drawable/coldbev" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<Button
android:id="#+id/coldbutton"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:backgroundTint="#6E2C00"
android:textColor="#color/white"
android:text="View Cold Drinks"
android:layout_gravity="center"/>
</ScrollView>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#EB984E"
app:itemIconTint="#6E2C00"
app:itemTextColor="#6E2C00"
app:menu="#menu/menu_navigation" />
</RelativeLayout>
As of right now it looks like this :
https://ibb.co/4JP6cPP
just put scrollView in root view
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".Bottom_Nav"
android:fillViewport="true"
android:background="#drawable/bg7">
<LinearLayout
android:id="#+id/titlemenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/pacifico_regular"
android:text="Menu"
android:textColor="#6E2C00"
android:textSize="50dp"
android:textStyle="bold"
android:layout_gravity="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/carterone_regular"
android:text="View Our Seelction!"
android:textColor="#6E2C00"
android:textSize="20dp"
android:textStyle="bold"
android:layout_gravity="center"/>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/titlemenu"
android:layout_above="#id/bottom_navigation">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<androidx.cardview.widget.CardView
android:id="#+id/hot"
android:layout_width="320dp"
android:layout_height="match_parent"
app:cardCornerRadius="15dp"
android:layout_marginTop="10dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#EB984E"
android:padding="10dp">
<TextView
android:id="#+id/t1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:fontFamily="#font/carterone_regular"
android:text="Cold Drinks"
android:textColor="#6E2C00"
android:textSize="30dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/t1"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:fontFamily="#font/carterone_regular"
android:text="Cool Off With Our Cold Bevs!"
android:textStyle="bold" />
<ImageView
android:layout_width="116dp"
android:layout_height="82dp"
android:layout_alignParentRight="true"
android:layout_marginRight="-31dp"
android:maxHeight="200dp"
android:src="#drawable/coldbev" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<Button
android:id="#+id/coldbutton"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:backgroundTint="#6E2C00"
android:textColor="#color/white"
android:text="View Cold Drinks"
android:layout_gravity="center"/>
</ScrollView>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#EB984E"
app:itemIconTint="#6E2C00"
app:itemTextColor="#6E2C00"
app:menu="#menu/menu_navigation" />
</ScrollView>
I Have Two Fragment class for my project, On my first FragmentA, I have added a FrameLayout to the FragmentA xml file,named as filter_pop_up_frame_lyt_container. so on a button click from from FragmentA, Im adding a new FragmentB to the framelayout of FragmentA. so my intention was to see the framelayout height to be match parent. When my recyclerView items in FragmentA is loaded, the height of the Frame Layout taking only the height of the FragmentB . How can we make the framelayout matchparent.
Tried with this solution :FrameLayout height not matching parent , but not working for me.
sampleCode for my FragmentA xml File:
<?xml version="1.0" encoding="utf-8"?>
<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:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/tastry_btn_txt"
tools:openDrawer="start">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<com.agrawalsuneet.dotsloader.loaders.CircularDotsLoader
android:id="#+id/circle_dot_loader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:elevation="100dp"
android:foregroundGravity="center"
android:visibility="visible"
app:loader_bigCircleRadius="25dp"
app:loader_circleRadius="5dp"
app:loader_defaultColor="#color/blue_dark"
app:loader_firstShadowColor="#color/lit_grey6"
app:loader_secondShadowColor="#color/lit_grey4"
app:loader_selectedColor="#color/lit_grey3"
app:loader_showRunningShadow="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- The ActionBar displayed at the top -->
<androidx.appcompat.widget.Toolbar xmlns:app="http://schemas.android.com/tools"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/palate_survey_bg"
app:ignore="NamespaceTypo"
local:popupTheme="#style/ThemeOverlay.AppCompat.Light"
local:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<androidx.appcompat.widget.SearchView
android:id="#+id/Advance_search"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginEnd="50dp"
android:background="#drawable/filter_search_bar_bg_lyt"
app:iconifiedByDefault="false"
app:queryHint="Search">
</androidx.appcompat.widget.SearchView>
<View
android:id="#+id/filter_loc_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="20dp"
android:layout_marginTop="40dp"
android:background="#99a3bc" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"></LinearLayout>
</androidx.appcompat.widget.Toolbar>
<LinearLayout
android:id="#+id/search_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/toolbar"
android:background="#66100202"
android:clickable="true"
android:orientation="vertical"
android:translationZ="15dp"
android:visibility="gone">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:fontFamily="sans-serif-medium"
android:text="Popular Searches"
android:textColor="#color/white"
android:textSize="22dp"
android:textStyle="normal">
</TextView>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recycler_advance_search"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/toolbar"
android:orientation="vertical">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/tastry_btn_txt"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/filter_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:src="#drawable/filter">
</ImageView>
<TextView
android:id="#+id/filter_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:fontFamily="sans-serif-medium"
android:text="Filter By"
android:textColor="#color/white"
android:textSize="22sp"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:id="#+id/filter_container_lyt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/filter_layout"
android:layout_alignParentTop="true"
android:layout_marginTop="2dp"
android:background="#495471"
android:gravity="center_vertical"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recycler_view_filter_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabTextAppearance="#android:style/TextAppearance.Widget.TabWidget" />
</LinearLayout>
<RelativeLayout
android:id="#+id/wine_complete_lyt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/filter_layout"
android:layout_marginStart="3dp"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recycler_view_red_wine_category"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp" />
</RelativeLayout>
<FrameLayout
android:id="#+id/filter_pop_up_frame_lyt_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/filter_layout"
android:background="#color/orange"
android:elevation="50dp"
android:translationZ="30dp" />
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</RelativeLayout>
<com.google.android.material.navigation.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/palate_survey_bg"
android:fitsSystemWindows="true"
app:headerLayout="#layout/header"
app:itemIconSize="20dp"
app:itemIconTint="#color/white"
app:itemTextColor="#color/white"
app:menu="#menu/drawermenu" />
</androidx.drawerlayout.widget.DrawerLayout>
sampleCode for FragmentB 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:id="#+id/linear_layout_root_price_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#66FF0000"
android:orientation="vertical">
<!-- android:background="#drawable/filter_bg_round_corner"-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/filter_bg_round_corner"
android:orientation="vertical">
<LinearLayout
android:id="#+id/progress_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="vertical">
<com.google.android.material.slider.RangeSlider
android:id="#+id/filter_price_ranger_Slider"
style="#style/Theme.TastrySampleApp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressDrawable="#drawable/progress_layout_bg"
android:stepSize="1"
android:theme="#style/Theme.TastrySampleApp"
android:valueFrom="0.0"
android:valueTo="100.0"
app:labelBehavior="gone"
app:thumbColor="#01b0c3"
app:tickVisible="false"
app:values="#array/initial_slider_values" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/onStartTrackingTouch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="9dp"
android:ellipsize="end"
android:maxLines="1"
android:text="$0"
android:textColor="#color/black"
android:textSize="16sp">
</TextView>
<TextView
android:id="#+id/onStopTrackingTouch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:ellipsize="end"
android:maxLines="1"
android:text="$100+"
android:textColor="#color/black"
android:textSize="16sp">
</TextView>
</RelativeLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:layout_marginTop="20dp"
android:background="#99a3bc">
</View>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:gravity="right"
android:orientation="horizontal"
android:padding="14dp">
<TextView
android:id="#+id/filter_price_wine_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:text="1234"
android:textColor="#color/black"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone">
</TextView>
<TextView
android:id="#+id/filter_price_wine_txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_weight="0"
android:ellipsize="end"
android:maxLines="1"
android:text="Wines"
android:textColor="#color/black"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone">
</TextView>
<View
android:layout_width="0dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:layout_weight="1" />
<LinearLayout
android:id="#+id/filter_price_root_clear_lyt"
android:layout_width="110dp"
android:layout_height="35dp"
android:layout_gravity="center"
android:layout_marginLeft="50dp"
android:layout_toLeftOf="#+id/filter_price_Apply"
android:background="#drawable/filter_clear_bg"
android:gravity="center"
android:visibility="gone">
<ImageView
android:id="#+id/close_filter_price"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:src="#drawable/close_white">
</ImageView>
<TextView
android:id="#+id/clear_price_filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginTop="3dp"
android:layout_toRightOf="#id/close_filter_price"
android:text="Clear All"
android:textColor="#f2faff"
android:textStyle="bold">
</TextView>
<TextView
android:id="#+id/price_clear_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginTop="3dp"
android:layout_toRightOf="#id/clear_price_filter"
android:textColor="#f2faff"
android:textStyle="bold">
</TextView>
</LinearLayout>
<com.google.android.material.button.MaterialButton
android:id="#+id/filter_price_Apply"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:background="#drawable/filter_apply_bg"
android:gravity="center"
android:text="Apply"
android:textAllCaps="false"
android:textColor="#f2faff"
android:textSize="12sp"
android:visibility="gone">
</com.google.android.material.button.MaterialButton>
</LinearLayout>
</LinearLayout>
</LinearLayout>
When I removed the scrollview from the layout , the height of the frame layout was set to match parent. Worked perfectly.
I am using a fragment to display cardview and a common Bottomnavigation for all fragments. Here I have more than 5 cards as per my data but I am not able to scroll to see all cards. only scrollable up to the second card and the second one is also not fully visible due to the bottom navigation.
main_activity.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff293353"
android:paddingTop="20dp">
<fragment
android:id="#+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_above="#id/nav_view"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="#navigation/mobile_navigation" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/nav_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:background="#drawable/bottom_tab_style"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="#menu/bottom_nav_menu" />
</androidx.constraintlayout.widget.ConstraintLayout>
Then Recycleview
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_height="wrap_content"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:weightSum="1"
android:layout_marginStart="70dp"
android:layout_marginEnd="70dp"
android:layout_gravity="center"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:background="#drawable/left_enabled"
android:layout_weight="0.5"
android:textAlignment="center"
android:id="#+id/btn_normal"
android:text="#string/normal"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:id="#+id/btn_cognitive"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="#drawable/right_disabled"
android:gravity="center"
android:text="#string/cognitive"
android:textAlignment="center"
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_marginTop="5dp"
android:layout_height="wrap_content">
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
</ScrollView>
Then cardview content
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:background="#drawable/cardstyle"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
>
<com.google.android.material.card.MaterialCardView
android:id="#+id/cardView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/transparent"
card_view:cardBackgroundColor="#color/transparent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
card_view:cardCornerRadius="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="2dp"
android:layout_marginStart="2dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#3f4865"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dp"
>
<TextView
android:id="#+id/txt_recordTitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="#font/poppins"
android:paddingStart="12dp"
android:text="Normal Test 01"
android:gravity="center_vertical"
android:textColor="#color/white"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="10dp"
android:src="#drawable/ic_card_walk" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/parameter1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins"
android:letterSpacing="0.12"
android:text="No: of gait cycles"
android:textColor="#cecece"
android:textSize="12sp" />
<TextView
android:id="#+id/p1_value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins"
android:letterSpacing="0.16"
android:text="Details"
android:textColor="#FFF"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="10dp"
android:src="#drawable/ic_card_walk" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/parameter2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins"
android:letterSpacing="0.12"
android:text="Stride Length"
android:textColor="#cecece"
android:textSize="12sp" />
<TextView
android:id="#+id/p2_value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins"
android:letterSpacing="0.16"
android:text="Details"
android:textColor="#FFF"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="10dp"
android:src="#drawable/ic_card_walk" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/parameter3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins"
android:letterSpacing="0.12"
android:text=" Gait time"
android:textColor="#cecece"
android:textSize="12sp" />
<TextView
android:id="#+id/p3_value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/poppins"
android:letterSpacing="0.16"
android:text="p2"
android:textColor="#FFF"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="#drawable/info_button_style"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="#string/total_n_gait_score"
android:textAlignment="center"
android:textColor="#FFF" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<ProgressBar
android:id="#+id/card_progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:background="#drawable/circle_shape"
android:indeterminate="false"
android:max="100"
android:progress="65"
android:progressDrawable="#drawable/card_progress" />
<TextView
android:id="#+id/text_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="60%"
android:textAppearance="#style/TextAppearance.AppCompat.Large"
android:textColor="#color/white" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:orientation="horizontal"
android:paddingBottom="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="1"
android:id="#+id/card_date"
android:text="date"
android:textColor="#FFF"
android:textSize="1sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:ellipsize="end"
android:maxLines="1"
android:text="time"
android:id="#+id/card_time"
android:textColor="#FFF"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Please check my code and help me with this.
This is wrong in your main_activity.xml for fragment android:layout_above="#id/nav_view", it is used for RelativeLayout. Instead use app:layout_constraintBottom_toTopOf="#id/nav_view". This will solve your second issue(the second one is also not fully visible due to the bottom navigation).
Change your ScrollView to NestedScrollView.
In your cardview content you don't need ConstraintLayout, LinearLayout is sufficient as root element (remove ConstraintLayout as you are not utilising its power of flat view hierarchy). And if your LinearLayout background can be moved to background for MaterialCardView then you don't need LinearLayout too.
For your recyclerview set the nestedScrollingEnabled to false either through xml or by code. Try these things, it will solve your problem.
I am trying to bring the Proceed button at the bottom but it is not aligned with the bottom. This problem occurs when I use ScrollView, Below is the XML and image. I tried every possible way to bring the proceed button at the bottom with ScrollView inside the XML.
If I do not include scrollView the layout is according to what i need
screenshot
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/backgroundColor"
xmlns:android="http://schemas.android.com/apk/res/android">
<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"
android:background="#color/backgroundColor">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="USER AGREEMENT"
android:textColor="#android:color/white"
android:gravity="center"
android:id="#+id/userAgereement"
android:layout_marginTop="20dp"
android:textSize="#dimen/textSize"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Beijing Pinnacle Global & Alex Edu\n(BPGE & Alex Edu)"
android:textColor="#android:color/white"
android:gravity="center"
android:layout_marginEnd="5dp"
android:layout_marginStart="5dp"
android:id="#+id/belowHeadingText"
android:layout_marginTop="20dp"
android:textSize="#dimen/endSize"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Today's Date : 25th of August, 2019"
android:textColor="#android:color/white"
android:gravity="center"
android:layout_marginTop="20dp"
android:id="#+id/date"
android:textSize="#dimen/endSize"/>
<View
android:layout_width="270dp"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:background="#android:color/white"
android:layout_height="1dp">
</View>
<ImageView
android:layout_marginTop="20dp"
android:layout_width="171dp"
android:layout_height="239dp"
android:layout_gravity="center"
android:clickable="true"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:src="#drawable/useragreemnet"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="You Are Going To Sign The User Agreement\nKindly, Provide Us Your Details"
android:textColor="#android:color/white"
android:gravity="center"
android:id="#+id/belowImageText"
android:layout_marginTop="20dp"
android:textSize="#dimen/endSize"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_gravity="center"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:layout_width="230dp"
app:cardElevation="#dimen/elevation"
app:cardCornerRadius="#dimen/cornerRadiusForButtons"
app:cardBackgroundColor="#color/functionalityColor"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:layout_height="#dimen/buttonHeight">
<Button
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="#dimen/buttonHeight"
android:clickable="true"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:id="#+id/proceed"
android:text="PROCEED"
android:onClick="onClick"
android:textSize="#dimen/buttonTextSize"
android:textColor="#android:color/white"
android:background="#android:color/transparent"
android:layout_marginBottom="20dp"/>
</android.support.v7.widget.CardView>
</RelativeLayout>
</LinearLayout>
</ScrollView>
Use this xml code inside your layout file , it will keep Proceed Button at down
<?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:orientation="vertical">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/backgroundColor">
<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:background="#color/backgroundColor"
android:orientation="vertical">
<TextView
android:id="#+id/userAgereement"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="USER AGREEMENT"
android:textColor="#android:color/white"
android:textSize="#dimen/textSize" />
<TextView
android:id="#+id/belowHeadingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="5dp"
android:gravity="center"
android:text="Beijing Pinnacle Global & Alex Edu\n(BPGE & Alex Edu)"
android:textColor="#android:color/white"
android:textSize="#dimen/endSize" />
<TextView
android:id="#+id/date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="Today's Date : 25th of August, 2019"
android:textColor="#android:color/white"
android:textSize="#dimen/endSize" />
<View
android:layout_width="270dp"
android:layout_height="1dp"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:background="#android:color/white">
</View>
<ImageView
android:layout_width="171dp"
android:layout_height="239dp"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:clickable="true"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:src="#drawable/useragreemnet"
/>
<TextView
android:id="#+id/belowImageText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="You Are Going To Sign The User Agreement\nKindly, Provide Us Your Details"
android:textColor="#android:color/white"
android:textSize="#dimen/endSize" />
</LinearLayout>
</ScrollView>
<android.support.design.widget.BottomNavigationView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp">
<android.support.v7.widget.CardView
app:cardBackgroundColor="#color/functionalityColor"
app:cardCornerRadius="#dimen/cornerRadiusForButtons"
app:cardElevation="#dimen/elevation"
android:layout_width="230dp"
android:layout_height="#dimen/buttonHeight"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp">
<Button
android:id="#+id/proceed"
android:layout_width="match_parent"
android:layout_height="#dimen/buttonHeight"
android:layout_marginBottom="20dp"
android:background="#android:color/transparent"
android:clickable="true"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:onClick="onClick"
android:text="PROCEED"
android:textColor="#android:color/white"
android:textSize="#dimen/buttonTextSize" />
</android.support.v7.widget.CardView>
</RelativeLayout>
</android.support.design.widget.BottomNavigationView>
</RelativeLayout>
I have this form and when the soft keyboard is open, the screen does not resize and dont make scroll on it.
I really want to know why. Why my view does not scroll? Why does not resize?
This 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"
android:fitsSystemWindows="true"
>
<ScrollView
android:layout_width="match_parent"
android:fillViewport="true"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="#android:color/transparent"
android:visibility="invisible"
app:navigationIcon="#drawable/ic_left_arrow"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
<ImageView
android:id="#+id/imageView9"
android:layout_width="180dp"
android:layout_height="70dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/toolbar"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginLeft="10dp"
android:src="#drawable/logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageView9"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/imageView9"
android:layout_below="#+id/imageView9"
android:layout_marginLeft="15dp"
android:paddingBottom="6dp"
android:text="OFERTAR OU \nSIMULAR LANCE"
android:textColor="#eb262a"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="horizontal">
<RadioButton
android:id="#+id/livre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lance Livre" />
<RadioButton
android:id="#+id/fixo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lance Fixo" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout2"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Percentual do lance">
<EditText
android:id="#+id/percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textView12"
android:layout_toStartOf="#+id/textView12"
android:ems="10"
android:inputType="numberDecimal"
android:nextFocusDown="#+id/value"
android:textSize="14dp" />
</android.support.design.widget.TextInputLayout>
<TextView
android:id="#+id/textView12"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="%"
android:textColor="#000"
android:textSize="16dp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Valor do lance">
<EditText
android:id="#+id/value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberDecimal"
android:textSize="14dp" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:hint="Número do Protocolo">
<EditText
android:id="#+id/protocol"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number"
android:textSize="14dp" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="30dp"
android:orientation="horizontal"
android:weightSum="10">
<Button
android:id="#+id/limpar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Limpar"
android:textColor="#ffffff"
android:visibility="visible" />
<Button
android:id="#+id/simular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Simular"
android:textColor="#ffffff"
android:visibility="visible" />
<Button
android:id="#+id/registrar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Registrar"
android:textColor="#ffffff"
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="#+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="20dp"
android:text="Lance Fixo é definido em 30%"
android:textAlignment="center"
android:textColor="#000"
android:textSize="16sp"
android:visibility="gone" />
</LinearLayout>
</ScrollView>
</LinearLayout>
I already tried set match_parent to scrollview.
And I have this in my manifest android:windowSoftInputMode="stateAlwaysHidden|adjustResize".
If you are using "FULLSCREEN" theme for your application or activity then the "RESIZE" functionality will not work, you should use "NoTitleBar" theme without "FULLSCREEN".
It will work 100%.
And you should use "RelativeLayout" in place of parent layout(main linearlayout).
I found the problem. I'm using <item name="android:windowFullscreen">true</item>
and when the fullscreen flags are actived, the resize dont work.
If you want to resize the activity when the keyboard pops up you need to specify a line of code in manifest file inside activity tag :
android:windowSoftInputMode="adjustResize"
Refer this link for more details : https://developer.android.com/training/keyboard-input/visibility.html
You can even try to adjust screen in activity put the below code in you activity onCreate method:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE|WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
Hope this should help!!
add this line to activity which you want to resize on opening soft keyboard:
android:windowSoftInputMode="adjustResize"
UPDATE POST:
<?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"
android:fitsSystemWindows="true"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="10dp"
android:background="#android:color/transparent"
android:visibility="invisible"
app:navigationIcon="#drawable/ic_left_arrow"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>
<ImageView
android:id="#+id/imageView9"
android:layout_width="180dp"
android:layout_height="70dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/toolbar"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginLeft="10dp"
android:src="#drawable/logo"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/imageView9"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/imageView9"
android:layout_below="#+id/imageView9"
android:layout_marginLeft="15dp"
android:paddingBottom="6dp"
android:text="OFERTAR OU \nSIMULAR LANCE"
android:textColor="#eb262a"
android:textSize="20sp"
android:textStyle="bold"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:orientation="horizontal">
<RadioButton
android:id="#+id/livre"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lance Livre"/>
<RadioButton
android:id="#+id/fixo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Lance Fixo"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout2"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Percentual do lance">
<EditText
android:id="#+id/percent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/textView12"
android:layout_toStartOf="#+id/textView12"
android:ems="10"
android:inputType="numberDecimal"
android:nextFocusDown="#+id/value"
android:textSize="14dp"/>
</android.support.design.widget.TextInputLayout>
<TextView
android:id="#+id/textView12"
android:layout_width="25dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="%"
android:textColor="#000"
android:textSize="16dp"
android:textStyle="bold"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Valor do lance">
<EditText
android:id="#+id/value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="numberDecimal"
android:textSize="14dp"/>
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/text_input_layout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:hint="Número do Protocolo">
<EditText
android:id="#+id/protocol"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number"
android:textSize="14dp"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="30dp"
android:orientation="horizontal"
android:weightSum="10">
<Button
android:id="#+id/limpar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Limpar"
android:textColor="#ffffff"
android:visibility="visible"/>
<Button
android:id="#+id/simular"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Simular"
android:textColor="#ffffff"
android:visibility="visible"/>
<Button
android:id="#+id/registrar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="5"
android:backgroundTint="#android:color/holo_red_light"
android:text="Registrar"
android:textColor="#ffffff"
android:visibility="gone"/>
</LinearLayout>
<TextView
android:id="#+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="20dp"
android:text="Lance Fixo é definido em 30%"
android:textAlignment="center"
android:textColor="#000"
android:textSize="16sp"
android:visibility="gone"/>
</LinearLayout>
</ScrollView>
</LinearLayout>