ScrollView is not scrolling in android - android

Hi i am new for android and I cant understand why this is happening. I am unable to scroll my scrollview. It has a textView , an imageview and few linear layouts inside of it and my code is below
can some one help me please
code:-
<?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="#android:color/white"
android:orientation="vertical"
android:theme="#style/Content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:animateLayoutChanges="true"
android:orientation="vertical"
android:scrollbars="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/enter_basicinformation_title" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/edit_text_margin_top"
android:layout_weight="2">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<fr.ganfra.materialspinner.MaterialSpinner
android:id="#+id/spinState"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
app:ms_arrowColor="#color/text_hint_color"
app:ms_arrowSize="16dp"
app:ms_floatingLabelColor="#color/text_hint_color"
app:ms_floatingLabelText="#string/sir_name_title"
app:ms_highlightColor="#color/colorAccent"
app:ms_hint="#string/sir_name_title"
app:ms_multiline="true" />
</RelativeLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:theme="#style/TextFieldInputLayout">
<EditText
android:id="#+id/username_id"
style="#style/MaterialDesignEditTextStyle"
android:drawablePadding="10dp"
android:hint="#string/username_hint"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:nextFocusDown="#+id/lastname_id" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/edit_text_margin_top"
android:theme="#style/TextFieldInputLayout">
<EditText
android:id="#+id/lastname_id"
style="#style/MaterialDesignEditTextStyle"
android:drawablePadding="10dp"
android:hint="#string/last_name_hint"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:nextFocusDown="#+id/email_id" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/edit_text_margin_top"
android:theme="#style/TextFieldInputLayout">
<EditText
android:id="#+id/email_id"
style="#style/MaterialDesignEditTextStyle"
android:drawablePadding="10dp"
android:hint="#string/email_id_hint"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:nextFocusDown="#+id/re_email_id" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/edit_text_margin_top"
android:theme="#style/TextFieldInputLayout">
<EditText
android:id="#+id/re_email_id"
style="#style/MaterialDesignEditTextStyle"
android:drawablePadding="10dp"
android:hint="#string/re_email_id_hint"
android:imeOptions="actionNext"
android:inputType="textPersonName" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/edit_text_margin_top"
android:theme="#style/TextFieldInputLayout">
<EditText
android:id="#+id/password_id"
style="#style/MaterialDesignEditTextStyle"
android:drawablePadding="10dp"
android:hint="#string/password_hint"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:nextFocusDown="#+id/re_password_id" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/TextFieldInputLayout">
<EditText
android:id="#+id/re_password_id"
style="#style/MaterialDesignEditTextStyle"
android:drawablePadding="10dp"
android:hint="#string/re_reenter_password_hint"
android:imeOptions="actionNext"
android:inputType="textPersonName" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/register_button_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="#string/register_title"
android:theme="#style/greenColorButton" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:text="#string/existing_user_title" />
</LinearLayout>
</ScrollView>
screen:-

// Make parent layout scroll and put linear layout inside .
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical"
android:scrollbars="vertical" >
...
...
</LinearLayout>
</ScrollView>

Try this:
I have removed the #style/content, add it later again. The rest is modified like i have told you in the comments
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:background="#android:color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:animateLayoutChanges="true"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/enter_basicinformation_title" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/edit_text_margin_top"
android:layout_weight="2">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<fr.ganfra.materialspinner.MaterialSpinner
android:id="#+id/spinState"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
app:ms_arrowColor="#color/text_hint_color"
app:ms_arrowSize="16dp"
app:ms_floatingLabelColor="#color/text_hint_color"
app:ms_floatingLabelText="#string/sir_name_title"
app:ms_highlightColor="#color/colorAccent"
app:ms_hint="#string/sir_name_title"
app:ms_multiline="true" />
</RelativeLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:theme="#style/TextFieldInputLayout">
<EditText
android:id="#+id/username_id"
style="#style/MaterialDesignEditTextStyle"
android:drawablePadding="10dp"
android:hint="#string/username_hint"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:nextFocusDown="#+id/lastname_id" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/edit_text_margin_top"
android:theme="#style/TextFieldInputLayout">
<EditText
android:id="#+id/lastname_id"
style="#style/MaterialDesignEditTextStyle"
android:drawablePadding="10dp"
android:hint="#string/last_name_hint"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:nextFocusDown="#+id/email_id" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/edit_text_margin_top"
android:theme="#style/TextFieldInputLayout">
<EditText
android:id="#+id/email_id"
style="#style/MaterialDesignEditTextStyle"
android:drawablePadding="10dp"
android:hint="#string/email_id_hint"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:nextFocusDown="#+id/re_email_id" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/edit_text_margin_top"
android:theme="#style/TextFieldInputLayout">
<EditText
android:id="#+id/re_email_id"
style="#style/MaterialDesignEditTextStyle"
android:drawablePadding="10dp"
android:hint="#string/re_email_id_hint"
android:imeOptions="actionNext"
android:inputType="textPersonName" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/edit_text_margin_top"
android:theme="#style/TextFieldInputLayout">
<EditText
android:id="#+id/password_id"
style="#style/MaterialDesignEditTextStyle"
android:drawablePadding="10dp"
android:hint="#string/password_hint"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:nextFocusDown="#+id/re_password_id" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/TextFieldInputLayout">
<EditText
android:id="#+id/re_password_id"
style="#style/MaterialDesignEditTextStyle"
android:drawablePadding="10dp"
android:hint="#string/re_reenter_password_hint"
android:imeOptions="actionNext"
android:inputType="textPersonName" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/register_button_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="#string/register_title"
android:theme="#style/greenColorButton" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="25dp"
android:text="#string/existing_user_title" />
</LinearLayout>
</ScrollView>
</FrameLayout>

Related

TextInputEditText with adjustPan - can't see entered text

I'm playing with TextInputEditText and I'm front face a strange issue. When I edit the content of the first one, let's say the "Nom" field, everything looks good, the keyboard appears and I can see the entered text. Now if I need to enter a text in a text field which is under the keyboard, the Activity pans up so the field is in view, but I can NOT see the text that I'm entering... Please have a look at this video: https://www.digitalblend.fr/android_TextInputEditText_issue.mp4
Moreover please have a look at my actual code :
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MessageFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="30dp"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="120dp" />
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/required_last_name"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/lastname"
android:layout_width="match_parent"
android:padding="5dp"
android:maxLines="1"
android:hint=""
android:inputType="textPersonName"
android:nextFocusDown="#+id/firstname"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<View
android:layout_width="10dp"
android:layout_height="0dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/first_name"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/firstname"
android:layout_width="match_parent"
android:padding="5dp"
android:hint=""
android:maxLines="1"
android:inputType="textPersonName"
app:textInputLayoutFocusedRectEnabled="true"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/required_mail"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/email"
android:layout_width="match_parent"
android:padding="5dp"
android:hint=""
android:maxLines="1"
android:inputType="textEmailAddress"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/required_enterprise"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/enterprise"
android:layout_width="match_parent"
android:padding="5dp"
android:maxLines="1"
android:hint=""
android:inputType="text"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/required_code_postal"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/postal_code"
android:layout_width="match_parent"
android:padding="5dp"
android:maxLines="1"
android:hint=""
android:inputType="text"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/city"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/city"
android:layout_width="match_parent"
android:padding="5dp"
android:maxLines="1"
android:hint=""
android:inputType="text"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/phone_number_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"
android:text="#string/required_tel"/>
<com.google.android.material.textfield.TextInputLayout
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:background="#android:color/transparent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/phone_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="5dp"
android:paddingHorizontal="15dp"
android:maxLines="1"
android:inputType="text"
android:textColor="#color/black"
android:imeOptions="actionDone"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/btn_buy"
android:layout_width="match_parent"
android:layout_height="50dp"
android:scaleType="fitCenter"
android:background="#drawable/little_red_button"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginTop="20dp"
android:text="#string/send_demand"
android:gravity="center"
android:textColor="#color/white"
android:textSize="14sp"/>
</LinearLayout>
</ScrollView>
In my manifest I used android:windowSoftInputMode="adjustPan">
If someone has an idea ? Thanks in advance.

android scrollview not working with cardView and with noActionBar theme

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.

TextInputLayout inside the scrollview

I am using TextInputLayout inside the scrollview , when i come to the app then the view is visible fine but when i start scrollview then the view start scrollview but original view is also shown below it. I am attaching the snapshot please let me know the problem.
when i come to the app it looks like this :
and when i start scrolling it looks like this :
Here is my code:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background = "#android:color/transparent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/attch_photo_ll"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="5dp"
android:background="#CBCFD3"
>
<Button
android:id="#+id/attach_photo_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#null"
android:textStyle="bold"
android:textSize="#dimen/_13sdp"
android:inputType="textNoSuggestions"
android:paddingLeft="10dp"
android:textColor="#android:color/white"
android:text="Attach Photo"
/>
</LinearLayout>
<LinearLayout
android:id="#+id/photo_ll"
android:visibility="gone"
android:layout_width="#dimen/image_width"
android:layout_height="#dimen/image_height"
android:layout_margin="5dp"
android:layout_gravity="center"
android:gravity="center">
<ImageView
android:id="#+id/photo_img"
android:adjustViewBounds="true"
android:layout_width="#dimen/image_width"
android:layout_height="#dimen/image_height"
android:scaleType="fitXY"/>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_username"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/firstName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="First Name" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_lastName"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/lastName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Last Name" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_mobile_one"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/mobile_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile 1" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_mobile_two"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/mobile_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile 2 (Optional)" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="#dimen/_8sdp"
android:orientation="horizontal"
android:weightSum="3">
<android.support.design.widget.TextInputLayout
android:layout_weight="1"
android:id="#+id/input_layout_aadhar_card"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/aadhar_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Aadhar No." />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/aadhar_card1"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/aadhar_card2"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="#dimen/_8sdp"
android:layout_marginBottom="#dimen/_8sdp"
android:orientation="horizontal"
android:weightSum="3">
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pancard"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/pancard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Pan Card No."/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pancard1"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/pancard1"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pancard2"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/pancard2"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
Try this.
Remove the hint from the EditText and add the hint to TextInputLayout in your layout
For e.g
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_username"
android:layout_width="match_parent"
android:hint="First Name"
android:layout_height="wrap_content">
<EditText
android:id="#+id/firstName"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
please copy and paste following layout file with your existing your problem was solved:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/transparent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/attch_photo_ll"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="5dp"
android:background="#CBCFD3">
<Button
android:id="#+id/attach_photo_btn"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#null"
android:inputType="textNoSuggestions"
android:paddingLeft="10dp"
android:text="Attach Photo"
android:textColor="#android:color/white"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/photo_ll"
android:layout_width="#dimen/image_width"
android:layout_height="#dimen/image_height"
android:layout_gravity="center"
android:layout_margin="5dp"
android:gravity="center"
android:visibility="gone">
<ImageView
android:id="#+id/photo_img"
android:layout_width="#dimen/image_width"
android:layout_height="#dimen/image_height"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="First Name">
<EditText
android:id="#+id/firstName"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_lastName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Last Name">
<EditText
android:id="#+id/lastName"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_mobile_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile 1">
<EditText
android:id="#+id/mobile_one"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_mobile_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Mobile 2 (Optional)">
<EditText
android:id="#+id/mobile_two"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email">
<EditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:orientation="horizontal"
android:weightSum="3">
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_aadhar_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Aadhar No.">
<EditText
android:id="#+id/aadhar_card"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="#+id/aadhar_card1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="#+id/aadhar_card2"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:orientation="horizontal"
android:weightSum="3">
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pancard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Pan Card No.">
<EditText
android:id="#+id/pancard"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pancard1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="#+id/pancard1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pancard2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="#+id/pancard2"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>

android seekbar height in drawable

I have a seekbar which was very thick earlier. Later in the drawable i set height attribute and it is fine but it works only for SDK 23 or more.
SchedulePickupFragment.xml
<ScrollView
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:fillViewport="true"
android:id="#+id/imgFragment">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="in.junkart.junkart.SchedulePickupFragment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#E4E4E4">
<LinearLayout
tools:context="in.junkart.junkart.SchedulePickupFragment"
android:id="#+id/pickup_linearLayout"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#drawable/layout_bg"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true">
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/input_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:inputType="textAutoComplete|textPersonName"
android:imeOptions="actionNext"
android:hint="Name"
android:textColorHint="#color/colorPrimaryLight"
android:paddingLeft="15dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/input_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|phone"
android:imeOptions="actionNext"
android:hint="Phone"
android:textColorHint="#color/colorPrimaryLight"
android:paddingLeft="15dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pickup_time"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/input_pickup_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:hint="Pickup Time"
android:focusable="false"
android:textColorHint="#color/colorPrimaryLight"
android:paddingLeft="15dp" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="45dp"
android:orientation="horizontal">
<TextView
android:layout_width="150sp"
android:layout_height="wrap_content"
android:text="Estimate Weight:"
android:textSize="15sp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"/>
<TextView
android:id="#+id/estmtWght"
android:layout_width="70sp"
android:layout_height="wrap_content"
android:text="20 Kg"
android:textSize="15sp"
android:textColor="#color/colorPrimaryDark"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"/>
</LinearLayout>
<SeekBar
android:id="#+id/seekbar"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:max="10"
android:layout_marginTop="10dp"
android:progressDrawable="#drawable/progress"
android:thumb="#drawable/thumb"
>
</SeekBar>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<AutoCompleteTextView
android:id="#+id/input_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:imeOptions="actionNext"
android:hint="Address"
android:textColorHint="#color/colorPrimaryLight"
android:paddingLeft="15dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_locality"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<AutoCompleteTextView
android:id="#+id/input_locality"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:imeOptions="actionNext"
android:hint="Locality"
android:textColorHint="#color/colorPrimaryLight"
android:paddingLeft="15dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<AutoCompleteTextView
android:id="#+id/input_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:imeOptions="actionNext"
android:hint="Pin"
android:textColorHint="#color/colorPrimaryLight"
android:paddingLeft="15dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/input_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress|textAutoComplete"
android:imeOptions="actionDone"
android:hint="Email"
android:textColorHint="#color/colorPrimaryLight"
android:paddingStart="15dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_message"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/input_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:imeOptions="actionNext"
android:hint="Message (If Any)"
android:textColorHint="#color/colorPrimaryLight"
android:paddingLeft="15dp"
android:paddingStart="15dp"/>
</android.support.design.widget.TextInputLayout>
<ImageButton
android:layout_width="290dp"
android:layout_height="70dp"
android:id="#+id/btn_schedule_pickup"
android:layout_below="#+id/pickup_linearLayout"
android:layout_alignParentBottom="true"
android:src="#drawable/confirm_button_normal"
android:layout_centerHorizontal="true"
android:layout_marginBottom="0dp"
android:scaleType="fitXY"
android:background="#color/white"
android:layout_marginLeft="0dp"
android:layout_marginTop="30dp"
android:layout_marginRight="0dp" />
</LinearLayout>
<!-- Fix user request form (weight, mandatory location - address autofill, state hidden field, locality, pincode)-->
</RelativeLayout>
</ScrollView>
Progress.xml(in drawable)
<item
android:id="#android:id/background"
android:drawable="#drawable/background_fill"
android:height="4dp"
android:layout_height="4dp"
android:top="6dp">
</item>
<item
android:id="#android:id/progress"
android:height="4dp"
android:layout_height="4dp"
android:top="6dp">
<clip android:drawable="#drawable/progress_fill"/>
</item>
The height attribute in progress.xml seems to not work for sdk 22 and less.

android:imeOptions="actionNext" is working great, but screen is scrolling to top

I have a layout, and want to get good navigation with "Next" Button.
All is working, but in field "et_numero", cursor focus to next field, this is ok, but screen scroll to top, I have no clue why!
Any help will be apreciated!
<LinearLayout
android:id="#+id/ll_addpdv1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<!-- Aqui empieza el formulario -->
<android.support.design.widget.TextInputLayout
android:id="#+id/til_pdv_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/et_pdv_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/pdv_name"
android:inputType="text"
android:nextFocusDown="#+id/et_dueno" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/til_dueno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext">
<EditText
android:id="#+id/et_dueno"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/nombre_dueno"
android:imeOptions="actionNext"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
<Spinner
android:id="#+id/sp_proyectos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/layout_bg"
android:focusable="true"
android:nextFocusDown="#+id/et_calle"
android:padding="20dp"
android:visibility="gone" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:id="#+id/til_calle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2">
<EditText
android:id="#+id/et_calle"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:hint="#string/calle2"
android:imeOptions="actionNext"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/til_numero"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nextFocusDown="#+id/et_colonia"
android:layout_weight="0.8">
<EditText
android:id="#+id/et_numero"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:hint="#string/numero"
android:imeOptions="actionNext"
android:inputType="number" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/til_colonia"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/et_colonia"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/colonia2"
android:imeOptions="actionNext"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
<Spinner
android:id="#+id/sp_ciudades"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:background="#drawable/layout_bg"
android:imeOptions="actionNext"
android:padding="20dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<android.support.design.widget.TextInputLayout
android:id="#+id/til_cp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
>
<EditText
android:id="#+id/et_cp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/cp"
android:imeOptions="actionNext"
android:inputType="number"
android:maxLength="5"
/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/til_tel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.7"
>
<EditText
android:id="#+id/et_tel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/telefono2"
android:imeOptions="actionDone"
android:inputType="phone"
/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</LinearLayout>
<Button
android:id="#+id/b_next1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/ll_addpdv1"
android:background="#drawable/button_azul_states"
android:paddingBottom="50dp"
android:paddingTop="50dp"
android:text="#string/siguiente"
android:textColor="#color/white" />
</RelativeLayout>

Categories

Resources