I'm trying to create a layout like below.
The problem is that the FAB is changing position in some devices because i have hardcoded the bottom margin.
I want the FAB as like in the below image.
PRESENT CODE
<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:background="#drawable/mlogin">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:id="#+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="30dp"
android:elevation="8dp"
app:cardCornerRadius="10dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="30dp"
android:orientation="vertical">
<ImageView
android:id="#+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="10dp"
android:src="#drawable/selfiel" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:text="Login"
android:textAlignment="center"
android:textColor="#color/colorAccent"
android:textSize="22sp" />
<!-- Email Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/input_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:inputType="textEmailAddress"
android:textColor="#color/white" />
</android.support.design.widget.TextInputLayout>
<!-- Password Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp">
<EditText
android:id="#+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="textPassword"
android:textColor="#color/white" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/forgot"
android:layout_centerHorizontal="true"
android:layout_marginBottom="103dp"
android:src="#drawable/ic_done" />
<TextView
android:id="#+id/forgot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/submit"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:text="Forgot password?"
android:textColor="#color/white"
android:textSize="18sp" />
<android.support.v7.widget.AppCompatButton
android:id="#+id/submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_margin="20dp"
android:background="#color/colorAccent"
android:onClick="submit"
android:text="Sign Up"
android:textColor="#color/white"
android:textSize="18sp" />
</RelativeLayout>
</RelativeLayout>
You probably want to use the CoordinatorLayout.
The basic layout would be as follows:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/mlogin">
<android.support.v7.widget.CardView
android:id="#+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="30dp"
android:elevation="8dp"
app:cardCornerRadius="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="30dp"
android:orientation="vertical">
<ImageView
android:id="#+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="10dp"
android:src="#drawable/selfiel" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:text="Login"
android:textAlignment="center"
android:textColor="#color/colorAccent"
android:textSize="22sp" />
<!-- Email Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/input_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:inputType="textEmailAddress"
android:textColor="#color/white" />
</android.support.design.widget.TextInputLayout>
<!-- Password Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp">
<EditText
android:id="#+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="textPassword"
android:textColor="#color/white" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="bottom">
<TextView
android:id="#+id/forgot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Forgot password?"
android:textColor="#color/white"
android:textSize="18sp" />
<android.support.v7.widget.AppCompatButton
android:id="#+id/submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:text="Sign Up"
android:onClick="submit"
android:background="#color/colorAccent"
android:textColor="#color/white"
android:textSize="18sp"
android:layout_gravity="bottom|center_horizontal" />
</LinearLayout>
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_done"
app:layout_anchor="#id/card"
app:layout_anchorGravity="bottom|center"/>
</android.support.design.widget.CoordinatorLayout>
The magic lines here are in the FloatingActionButton that say:
app:layout_anchor="#id/card"
app:layout_anchorGravity="bottom|center"
This essentially tells your layout that the FAB is related to the card, and that it should be positioned relative to the card (centered at the bottom).
You can find the CoordinatorLayout documentation here, and a pretty good tutorial here.
Best of luck!
use android:layout_gravity="bottom" instead Then adjust with margins if you want. so you can do this:
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/forgot"
android:layout_centerHorizontal="true"
android:layout_marginBottom="13dp"
android:layout_gravity="bottom"
android:src="#drawable/ic_done" />
Related
I have a problem I want the orange cardView on the top to be like this:
and when the user Scorll I have to make this orange card scroll as well
but I used coordinate layout with anchor for the card
I've to make it invisible when the user scrolls away a little bit but I have this:
my question is how to make this orange cardview to stay and scroll with other layout elements?
my xml file is:
<?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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_collapseMode="pin"
app:popupTheme="#style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:id="#+id/nested_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="#+id/profile_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:layout_marginLeft="#dimen/app_margin"
android:layout_marginRight="#dimen/app_margin"
android:layout_marginBottom="#dimen/app_margin"
app:elevation="3dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:layout_marginTop="60dp"
android:layout_marginBottom="#dimen/app_margin"
android:text="Mark Davis"
android:layout_centerHorizontal="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#id/username"
android:text="IT consuler"
android:layout_marginBottom="#dimen/app_margin"
android:id="#+id/textView" />
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/textView"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:elevation="3dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Personal Information"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.v7.widget.CardView>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_margin="#dimen/app_margin"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="#style/Base.TextAppearance.AppCompat.Medium"
android:text="Personal Inforamtion"
android:elevation="3dp"
android:textStyle="bold"
android:layout_margin="#dimen/app_margin"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Name"
android:textStyle="bold"
android:textSize="16sp"
android:textColor="#color/colorAccent"
android:layout_marginBottom="#dimen/app_margin"
android:layout_marginLeft="#dimen/app_margin"
android:textAppearance="#style/TextAppearance.AppCompat.Small"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="User Name"
android:layout_marginLeft="32dp"
android:layout_marginRight="#dimen/app_margin"
android:layout_marginBottom="#dimen/app_margin"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Email"
android:textStyle="bold"
android:textSize="16sp"
android:textColor="#color/colorAccent"
android:layout_marginBottom="#dimen/app_margin"
android:layout_marginLeft="#dimen/app_margin"
android:textAppearance="#style/TextAppearance.AppCompat.Small"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:layout_marginLeft="32dp"
android:layout_marginRight="#dimen/app_margin"
android:layout_marginBottom="#dimen/app_margin"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Display name"
android:textStyle="bold"
android:textSize="16sp"
android:textColor="#color/colorAccent"
android:layout_marginBottom="#dimen/app_margin"
android:layout_marginLeft="#dimen/app_margin"
android:textAppearance="#style/TextAppearance.AppCompat.Small"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Display name"
android:layout_marginLeft="32dp"
android:layout_marginRight="#dimen/app_margin"
android:layout_marginBottom="#dimen/app_margin"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password"
android:textStyle="bold"
android:textSize="16sp"
android:textColor="#color/colorAccent"
android:layout_marginBottom="#dimen/app_margin"
android:layout_marginLeft="#dimen/app_margin"
android:textAppearance="#style/TextAppearance.AppCompat.Small"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:layout_marginLeft="32dp"
android:layout_marginRight="#dimen/app_margin"
android:layout_marginBottom="#dimen/app_margin"/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.v7.widget.CardView
android:id="#+id/profile_pic"
android:layout_margin="#dimen/app_margin"
android:layout_width="100dp"
android:layout_height="100dp"
app:layout_anchor="#id/profile_card"
app:layout_anchorGravity="center|top"
app:cardCornerRadius="50dp"
app:cardBackgroundColor="#color/colorAccent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/ic_profile"/>
</android.support.v7.widget.CardView>
<android.support.design.widget.FloatingActionButton
android:id="#+id/buttonLove"
android:layout_width ="wrap_content"
android:layout_height="wrap_content"
android:src = "#drawable/ic_edit"
app:borderWidth="0dp"
android:elevation="5dp"
app:pressedTranslationZ="12dp"
app:rippleColor="#color/button_white"
android:onClick="onClick"
android:background="#color/colorAccent"
android:layout_margin="#dimen/app_margin"
android:layout_gravity="bottom|end"
app:fabSize="normal"
/>
</android.support.design.widget.CoordinatorLayout>
I need a help with CoordinatorLayout... I need hide/show toolbar when scrolling and together with this hiding behavior I need make smaller text and hide another layout in my AppBarLayout...
My layout looks like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="#+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/main_light_gray">
<include
layout="#layout/toolbar_layout_filter_sales" />
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
local:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/main_light_gray">
<android.support.design.widget.TabLayout
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:id="#+id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/tablayout_background"
local:tabIndicatorColor="#color/main_red"
local:tabIndicatorHeight="0dp"
local:tabGravity="center"
local:tabBackground="#drawable/tab_background_selector"
local:tabMode="fixed"
local:tabPaddingStart="20dp"
local:tabPaddingEnd="20dp"
local:tabTextColor="#color/main_dark_text"
local:tabSelectedTextColor="#color/white" />
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="fill_parent"
local:layout_behavior="#string/appbar_scrolling_view_behavior" />
</LinearLayout>
</RelativeLayout>
<!--</LinearLayout>-->
</android.support.design.widget.CoordinatorLayout>
Layout toolbar_layout_filter_sales looks like this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/layout_rounded_corners"
android:stateListAnimator="#null"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
local:layout_scrollFlags="scroll|enterAlways"
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
local:popupTheme="#style/ThemeOverlay.AppCompat.Light">
<LinearLayout
android:layout_marginTop="25dp"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<TextView
android:textStyle="bold"
android:textColor="#color/white"
android:id="#+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
style="#style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_gravity="center" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:id="#+id/toolbar_refresh_layout"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/toolbar_refresh"
android:layout_width="20dp"
android:layout_height="20dp"
android:scaleType="centerInside"
android:src="#drawable/ic_refresh" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
<LinearLayout
android:id="#+id/filterLayout"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dp">
<TextView
android:textSize="18dp"
android:textStyle="bold"
android:ellipsize="marquee"
android:maxLines="1"
android:text="Today"
local:MvxBind="Text SelectedFilterText"
android:textColor="#color/white"
android:id="#+id/filterTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="2dp"
android:layout_marginBottom="1dp" />
<Button
android:textAllCaps="false"
android:id="#+id/filterButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dp"
android:text="15.5.2018"
local:MvxBind="Text CurrentPeriod"
android:ellipsize="marquee"
android:maxLines="1"
android:textColor="#color/white"
android:gravity="center_vertical"
android:textStyle="normal"
android:background="#android:color/transparent"
android:drawableEnd="#drawable/arrow_down_white"
android:drawablePadding="10dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="0dp" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/main_dark_line"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="0dp" />
<LinearLayout
android:id="#+id/filterLayout"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp">
<TextView
android:text="58 395,00"
local:MvxBind="TextFormatted TotalSales, Converter=SpannableStringPriceConverter"
android:textSize="26dp"
android:textStyle="bold"
android:ellipsize="marquee"
android:maxLines="1"
android:textColor="#color/white"
android:id="#+id/salesTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp" />
<TextView
local:MvxBind="Text LastUpdate, Converter=LastUpdateConverter"
android:textSize="12dp"
android:textStyle="italic"
android:ellipsize="marquee"
android:maxLines="1"
android:text="XX"
android:textColor="#color/white"
android:id="#+id/lastUpdateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</LinearLayout>
</android.support.design.widget.AppBarLayout>
In default it looks like this:
After scrolling I have this:
But I need something like this:
I need text with value make smaller and text under value hide.
Below xml contains a ScrollView and a Cardview but scrolling is not working for the ScrollView. I have added below line in manifest for below layout:
<activity android:windowSoftInputMode="adjustPan"
android:name=".activities.RegisterActivity" />
Can anyone help me to fix this issue?
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="#+id/relative"
android:layout_width="match_parent"
android:layout_height="#dimen/margin_400dp"
android:layout_margin="#dimen/margin_10dp">
<android.support.v7.widget.CardView
android:id="#+id/cardview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
app:cardBackgroundColor="#color/white"
app:cardCornerRadius="#dimen/margin_5dp"
app:cardElevation="#dimen/margin_20dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/margin_10dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="#dimen/margin_10dp"
android:src="#drawable/user_default" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_10dp"
android:textColorHint="#color/blue">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="#dimen/margin_50dp"
android:hint="#string/Email"
android:inputType="textEmailAddress"
android:textColor="#color/blue"
android:textColorHint="#color/blue"
android:theme="#style/MyEditTextTheme" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="#color/blue">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="#dimen/margin_50dp"
android:hint="#string/Name"
android:inputType="text"
android:textColor="#color/blue"
android:textColorHint="#color/blue"
android:theme="#style/MyEditTextTheme" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/Password"
android:textColorHint="#color/blue"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#color/blue">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="#dimen/margin_50dp"
android:hint="#string/Password"
android:inputType="textPassword"
android:textColor="#color/blue"
android:textColorHint="#color/blue"
android:theme="#style/MyEditTextTheme" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
<android.support.v7.widget.AppCompatButton
android:id="#+id/btn_signup"
android:layout_width="#dimen/margin_120dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/relative"
android:layout_gravity="bottom|center"
android:layout_marginRight="#dimen/margin_60dp"
android:layout_marginTop="#dimen/margin_m65dp"
android:background="#drawable/rounded_textview"
android:gravity="center"
android:padding="#dimen/margin_10dp"
android:text="#string/Sign_up"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/relative"
android:layout_centerHorizontal="true"
android:layout_marginBottom="#dimen/margin_10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/margin_10dp"
android:text="#string/already_have_an_account"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:padding="#dimen/margin_5dp"
android:text="#string/Login"
android:textColor="#color/blue"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
Use android.support.v4.widget.NestedScrollView instead of ScrollView.
Here is a my scrollView xml
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/myCoordinator"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#drawable/gradient_toolbar"
android:clickable="true"
android:orientation="vertical">
<ImageView
android:id="#+id/u_back_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:padding="4dp"
android:src="#mipmap/arrow_back_blue" />
<TextView
android:id="#+id/headerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="#string/u_my_page"
android:textColor="#ffffff"
android:textSize="16dp" />
<TextView
android:id="#+id/my_profile_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="8dp"
android:gravity="center"
android:padding="8dp"
android:singleLine="true"
android:text="#string/u_save"
android:textColor="#ffffff"
android:textSize="14dp"
android:visibility="gone" />
</RelativeLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.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:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:orientation="vertical"
>
<LinearLayout
android:id="#+id/user_header_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:gravity="center_vertical"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:id="#+id/u_user_fullname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:maxLines="1"
android:singleLine="true"
android:textColor="#4d4d4d"
android:textSize="#dimen/u_common_text_size"
/>
</LinearLayout>
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:orientation="vertical">
<TextView
android:id="#+id/personal_settings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="30dp"
android:text="#string/u_personal_settings_txt"
android:textColor="#4d4d4d"
android:textSize="16dp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#cccccc" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:background="#drawable/selector_edittext_action"
android:textColor="#4d4d4d"
android:textColorHint="#b3b3b3">
<android.support.design.widget.TextInputEditText
android:id="#+id/first_name_lat"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#null"
android:hint="#string/u_first_name_lat"
android:imeOptions="actionNext"
android:inputType="textNoSuggestions"
android:textColor="#4d4d4d"
android:textColorHint="#b3b3b3"
android:textCursorDrawable="#null"
android:textSize="16dp"
app:backgroundTint="#android:color/white" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:background="#drawable/selector_edittext_action"
android:textColor="#4d4d4d"
android:textColorHint="#b3b3b3">
<android.support.design.widget.TextInputEditText
android:id="#+id/last_name_lat"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#null"
android:hint="#string/u_last_name_lat"
android:imeOptions="actionNext"
android:inputType="textNoSuggestions"
android:textColor="#4d4d4d"
android:textColorHint="#b3b3b3"
android:textCursorDrawable="#null"
android:textSize="16dp"
app:backgroundTint="#android:color/white" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:background="#drawable/selector_edittext_action"
android:textColor="#4d4d4d"
android:textColorHint="#b3b3b3">
<android.support.design.widget.TextInputEditText
android:id="#+id/u_address"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#null"
android:hint="#string/u_address"
android:imeOptions="actionNext"
android:inputType="textNoSuggestions"
android:textColor="#4d4d4d"
android:textColorHint="#b3b3b3"
android:textCursorDrawable="#null"
android:textSize="16dp"
app:backgroundTint="#android:color/white" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:background="#drawable/selector_edittext_action"
android:textColor="#4d4d4d"
android:textColorHint="#b3b3b3">
<android.support.design.widget.TextInputEditText
android:id="#+id/u_gender"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#null"
android:hint="#string/u_gender"
android:imeOptions="actionNext"
android:inputType="textNoSuggestions"
android:textColor="#4d4d4d"
android:textColorHint="#b3b3b3"
android:textCursorDrawable="#null"
android:textSize="16dp"
app:backgroundTint="#android:color/white" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
In my activity's SoftInputMode is adjustNothing.
As i said my scrollview not working.I search about my problem ,one solution is to change adjustResize,but i don't want this solution, because my AppBarLayout layout moving up.
My questions is that, is it a possible to move scrollview at the moment(adjustNothing).I can't show my last edittext when keyboard is showing.
Or,Is it a possible to disable move up AppBarLayout layout in my xml if I use adjustResize or adjustPan ?
Thanks everyone
Here is a solution
Add this line in NestedScrollView 's child Layout
android:descendantFocusability="afterDescendants"
and manifest file
android:windowSoftInputMode="adjustResize"
I developed an android application in which the scroll-view is not scrolling.. I am posting the code here pls check and if found any error pls help.. Here I used RelativeLayout as root and then Scroll-view and Relative Layout inside the scroll-view and ... Edit text ans Spinner inside relative layout... but this is not scrolling up..
This is my XML :-
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white">
<LinearLayout
android:id="#+id/ll1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/tool_bar"
layout="#layout/app_bar" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none"
android:layout_above="#+id/btnAccept"
android:layout_below="#+id/ll1"
>
<RelativeLayout
android:id="#+id/rel_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<TextView
android:id="#+id/txvPanmain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="WANT TO GET IN TOUCH WITH US?"
android:textColor="#131517"
android:textSize="18sp"
android:textStyle="bold" />
<android.support.design.widget.TextInputLayout
android:id="#+id/floatedtFullName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txvPanmain"
android:layout_marginTop="10dp">
<EditText
android:id="#+id/edtFullName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:focusable="true"
android:hint="Full Name"
android:inputType="textCapSentences"
android:textColor="#android:color/black"
android:textColorHint="#ff0000"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<Spinner
android:id="#+id/spinCountry"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/floatedtFullName"
android:layout_marginTop="15dp"
android:entries="#array/country"
android:prompt="#string/addressProof" />
<View
android:id="#+id/vspincountry"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/spinCountry"
android:layout_marginTop="2dp"
android:background="#000000" />
<Spinner
android:id="#+id/spinCity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/vspincountry"
android:layout_marginTop="15dp"
android:entries="#array/country"
android:prompt="#string/addressProof" />
<View
android:id="#+id/vspincity"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/spinCity"
android:layout_marginTop="2dp"
android:background="#000000" />
<android.support.design.widget.TextInputLayout
android:id="#+id/float_edit_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/vspincity"
android:layout_marginTop="10dp">
<EditText
android:id="#+id/edtEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:focusable="true"
android:hint="Email id"
android:inputType="textEmailAddress"
android:textColor="#android:color/black"
android:textColorHint="#A4A4A4"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/float_edit_mobileno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/float_edit_email"
android:layout_marginTop="10dp">
<EditText
android:id="#+id/edtMobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:focusable="true"
android:hint="Mobile no."
android:inputType="phone"
android:maxLength="10"
android:textColor="#android:color/black"
android:textColorHint="#A4A4A4"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<Spinner
android:id="#+id/spinFeedback"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/float_edit_mobileno"
android:layout_marginTop="10dp"
android:entries="#array/country"
android:prompt="#string/addressProof" />
<View
android:id="#+id/vspinFeedback"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="#+id/spinFeedback"
android:layout_marginTop="2dp"
android:background="#000000" />
<android.support.design.widget.TextInputLayout
android:id="#+id/float_edit_comments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/vspinFeedback"
android:layout_marginTop="10dp">
<EditText
android:id="#+id/edtComments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:focusable="true"
android:inputType="text"
android:hint="Comments"
android:lines="3"
android:maxLines="3"
android:textColor="#android:color/black"
android:textColorHint="#A4A4A4"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
</ScrollView>
<Button
android:id="#+id/btnAccept"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/red"
android:layout_alignParentBottom="true"
android:padding="5dp"
android:text="SUBMIT"
android:textColor="#color/white_color"
android:textSize="20sp"
android:textStyle="normal" />
<ProgressBar
android:id="#+id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" />
</RelativeLayout>
This is my app_bar.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar 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="wrap_content"
android:background="#color/colorPrimary"
android:paddingTop="#dimen/app_bar_top_padding"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:theme="#style/Base.ThemeOverlay.AppCompat.Dark.ActionBar">
<TextView
android:id="#+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="22sp"
android:textColor="#android:color/white"
android:textStyle="bold"
android:text="Toolbar Title" />
</android.support.v7.widget.Toolbar>
Your ScrollView has to be a defined height. Try match_parent instead of wrap_content. When a ScrollView wraps its contents there is nothing beeing clipped of you might be able to scroll to.