LinearLayout not scrolling when keyboard is appearing - android

I am facing a problem with ScrollView. When the keyboard is appearing, scrollview is not scrolling till the end of the view.
Here is my layout xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:text="Add Member"
android:textColor="#FFF"
android:textSize="#dimen/heading_text_size"
android:background="#color/heading"
android:gravity="center"
android:padding="10dp"
android:layout_height="?attr/actionBarSize"/>
<ScrollView
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<EditText
android:id="#+id/search_member_number"
android:layout_width="match_parent"
android:hint="Enter mobile number"
android:layout_weight="3"
android:inputType="phone"
android:layout_marginLeft="10dp"
android:layout_gravity="center"
android:layout_height="wrap_content"/>
<Button
android:id="#+id/searchExistingUserButton"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:text="Search"
android:textAllCaps="false"
android:background="#FF9800"
android:layout_margin="10dp"
android:layout_height="wrap_content"/>
</LinearLayout>
<EditText
android:id="#+id/txtUsername"
android:layout_width="match_parent"
android:layout_margin="10dp"
android:hint="Enter member name"
android:layout_height="wrap_content"/>
<EditText
android:id="#+id/txtAddress"
android:layout_width="match_parent"
android:hint="Address"
android:layout_margin="10dp"
android:layout_height="wrap_content"/>
<EditText
android:id="#+id/txtEmail"
android:layout_width="match_parent"
android:hint="Email"
android:layout_margin="10dp"
android:layout_height="wrap_content"/>
<EditText
android:id="#+id/txtContact"
android:layout_width="match_parent"
android:hint="Mobile No"
android:inputType="phone"
android:layout_margin="10dp"
android:layout_height="wrap_content"/>
<EditText
android:id="#+id/txtReferredBy"
android:layout_width="match_parent"
android:hint="Referred by"
android:layout_margin="10dp"
android:layout_height="wrap_content"/>
<AutoCompleteTextView
android:id="#+id/txtKittyGroups"
android:layout_width="match_parent"
android:hint="Enter kitty group name"
android:layout_margin="10dp"
android:layout_weight="8"
android:layout_gravity="center"
android:textSize="#dimen/admin_setup_buttons_text_size"
android:textColor="#000"
android:layout_height="wrap_content"/>
<EditText
android:id="#+id/txtRepeat"
android:layout_width="match_parent"
android:hint="Enter repeat number"
android:layout_margin="10dp"
android:inputType="number"
android:layout_height="wrap_content"/>
<Button
android:id="#+id/createUserButton"
android:layout_width="wrap_content"
android:layout_gravity="right"
android:text="Create Member"
android:textAllCaps="false"
android:background="#BBDEFB"
android:layout_margin="10dp"
android:padding="10dp"
android:layout_height="wrap_content"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
I have seen several posts in stackoverflow, but unfortunately none is working. What could be the possible solution?
Thanks in advance.

I think the problem is causing by adjustPan . Where adjust Pan does not resize the window, it pans the view so that whatever has focus is never obscured by the soft keyboard.
Add this to your AndroidManifest.xml . This might do the trick.
Example:
<activity android:name="YourActivity"
android:windowSoftInputMode="adjustResize" />

you need to add <Space/> and
android:layout_height="100dp"
give height static which you want.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:text="Add Member"
android:textColor="#FFF"
android:textSize="#dimen/heading_text_size"
android:background="#color/heading"
android:gravity="center"
android:padding="10dp"
android:layout_height="?attr/actionBarSize"/>
<ScrollView
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<EditText
android:id="#+id/search_member_number"
android:layout_width="match_parent"
android:hint="Enter mobile number"
android:layout_weight="3"
android:inputType="phone"
android:layout_marginLeft="10dp"
android:layout_gravity="center"
android:layout_height="wrap_content"/>
<Button
android:id="#+id/searchExistingUserButton"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:text="Search"
android:textAllCaps="false"
android:background="#FF9800"
android:layout_margin="10dp"
android:layout_height="wrap_content"/>
</LinearLayout>
<EditText
android:id="#+id/txtUsername"
android:layout_width="match_parent"
android:layout_margin="10dp"
android:hint="Enter member name"
android:layout_height="wrap_content"/>
<EditText
android:id="#+id/txtAddress"
android:layout_width="match_parent"
android:hint="Address"
android:layout_margin="10dp"
android:layout_height="wrap_content"/>
<EditText
android:id="#+id/txtEmail"
android:layout_width="match_parent"
android:hint="Email"
android:layout_margin="10dp"
android:layout_height="wrap_content"/>
<EditText
android:id="#+id/txtContact"
android:layout_width="match_parent"
android:hint="Mobile No"
android:inputType="phone"
android:layout_margin="10dp"
android:layout_height="wrap_content"/>
<EditText
android:id="#+id/txtReferredBy"
android:layout_width="match_parent"
android:hint="Referred by"
android:layout_margin="10dp"
android:layout_height="wrap_content"/>
<AutoCompleteTextView
android:id="#+id/txtKittyGroups"
android:layout_width="match_parent"
android:hint="Enter kitty group name"
android:layout_margin="10dp"
android:layout_weight="8"
android:layout_gravity="center"
android:textSize="#dimen/admin_setup_buttons_text_size"
android:textColor="#000"
android:layout_height="wrap_content"/>
<EditText
android:id="#+id/txtRepeat"
android:layout_width="match_parent"
android:hint="Enter repeat number"
android:layout_margin="10dp"
android:inputType="number"
android:layout_height="wrap_content"/>
<Button
android:id="#+id/createUserButton"
android:layout_width="wrap_content"
android:layout_gravity="right"
android:text="Create Member"
android:textAllCaps="false"
android:background="#BBDEFB"
android:layout_margin="10dp"
android:padding="10dp"
android:layout_height="wrap_content"/>
<Space
android:layout_width="match_parent"
android:layout_height="100dp" />
</LinearLayout>
</ScrollView>
</LinearLayout></LinearLayout>

Use this in your layout:
android:layout_marginBottom="16dp"

Related

Is this a real bug?

I don't know why, but my layout color just stops in the bottom of the screen.
I don't think my code is doing that.
And, by the way, does anyone know where to get ideas from a simple layout like this? TextViews and EditTexts?
Mine looks awful
<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:background="#color/AMOB_gray"
tools:context="com.example.tiagosilva.amob_android.TubeDataFragment" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp"
android:gravity="center"
android:background="#color/AMOB_gray">
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/material"
android:textColor="#color/AMOB_yellow"
android:textSize="25dp" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/snipperMaterial">
</Spinner>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/diameter"
android:textColor="#color/AMOB_yellow"
android:textSize="25dp" />
<EditText
android:id="#+id/et_diameter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/round"
android:ems="10"
android:inputType="number"
android:padding="10dp"
android:text="0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/thickness"
android:textColor="#color/AMOB_yellow"
android:textSize="25dp"
android:gravity="center"/>
<EditText
android:id="#+id/et_thickness"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/round"
android:ems="10"
android:inputType="number"
android:padding="10dp"
android:text="0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/clr"
android:textColor="#color/AMOB_yellow"
android:textSize="25dp"
android:gravity="center"/>
<EditText
android:id="#+id/et_clr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/round"
android:ems="10"
android:inputType="number"
android:padding="10dp"
android:text="0"/>
<Button
android:id="#+id/btn_save_tube"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/round_buttons"
android:text="#string/save"
android:textColor="#color/AMOB_gray"
android:layout_marginTop="10dp"/>
</LinearLayout>
</ScrollView>
Instead of this:
<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"
tools:context="com.example.tiagosilva.amob_android.TubeDataFragment" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp"
android:gravity="center"
android:background="#color/AMOB_gray">
Try this
<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"
tools:context="com.example.tiagosilva.amob_android.TubeDataFragment"
android:background="#color/AMOB_gray">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="20dp"
android:gravity="center">
So to move the background color inside the root ViewGroup
Add below line in your scroll view. This will do what you want
android:fillViewport="true"

Paste Text Field and Button over an ImageView in LinearLayout

This is the login activity I want to achieve in my app (Image2). But I do not know how to do so it because I cannot paste the editText, password and button over the white part of the image (the whole image has black border). The app has white background and I want to make the look of the image as curve and to place the other fields under it. For now it looks as image1.
and look this
I also want my image to be aligned to the bottom and its width to be match_parent and the height to be adjusted so that the ratio of the original image is saved on different devices. Here is my XML code:
<?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:id="#+id/banner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="5"
tools:context="com.example.android.start.MainActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
app:srcCompat="#drawable/logo"
android:id="#+id/logo"
android:layout_weight="2"
/>
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:id="#+id/back"
app:srcCompat="#drawable/image2"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:id="#+id/editText3" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:text="Name"
android:ems="10"
android:id="#+id/editText2" />
<Button
android:text="Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/button"
android:layout_centerInParent="true"/>
</LinearLayout>
You can do something like this
<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:id="#+id/banner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="5"
tools:context="com.example.android.start.MainActivity">
<ImageView
android:id="#+id/logo"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
app:srcCompat="#drawable/logo"
/>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:gravity="center"
app:srcCompat="#drawable/image2">
<EditText
android:id="#+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:ems="10"
android:inputType="textPassword"/>
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:text="Name"/>
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Button"/>
</LinearLayout>
Use RelativeLayout instead of LinearLayout it will hopefully solve your problem.
Here is the code I used to achieve the look from Image2:
<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:id="#+id/banner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="5"
tools:context="com.example.android.start.MainActivity">
<ImageView
android:id="#+id/logo"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
app:srcCompat="#drawable/logo" />
<FrameLayout
android:id="#+id/frame"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:background="#drawable/back"
android:weightSum="2">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#C8E6C9"
android:ems="10"
android:hint="Username"
android:inputType="textPersonName"
android:layout_marginBottom="117dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:text="Sign In"
android:background="#8BC34A"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="11dp" />
<EditText
android:id="#+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#C8E6C9"
android:ems="10"
android:hint="Password"
android:inputType="textPassword"
android:layout_above="#+id/button"
android:layout_alignLeft="#+id/name"
android:layout_alignStart="#+id/name"
android:layout_marginBottom="19dp" />
/>
</RelativeLayout>
</FrameLayout>
</LinearLayout>

Android layout with scrolling middle and fixed button bar at bottom of screen (button bar not showing)

I'm working on a screen layout but I am having a problem.
It has a Toolbar (being set as the action bar), a scrolling pane and a button bar at the bottom which is fixed to the bottom of the screen always visible.
For some reason though the button bar and buttons are not visible even if I scroll to the bottom of the screen, there is no sign of them.
Below is my XML layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="#layout/toolbar" />
<ScrollView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText android:id="#+id/db_txtConnectionName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Database Connection Name"
android:singleLine="true"
android:inputType="textNoSuggestions" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText android:id="#+id/db_txtServer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Server"
android:singleLine="true"
android:inputType="textNoSuggestions" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText android:id="#+id/db_txtUsername"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Username"
android:singleLine="true"
android:inputType="textNoSuggestions" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText android:id="#+id/db_txtPassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:singleLine="true"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<EditText android:id="#+id/db_txtDatabase"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Database"
android:singleLine="true"
android:inputType="textNoSuggestions" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText android:id="#+id/db_txtPort"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:maxLength="6"
android:hint="Port"
android:text="3306"
android:singleLine="true"
android:inputType="number"/>
</android.support.design.widget.TextInputLayout>
<CheckBox android:id="#+id/db_chkStorePassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/store_password"
android:checked="true" />
<CheckBox android:id="#+id/db_chkConnectViaSSHTunnel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Connect via SSH Tunnel"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="SSH Connection Settings" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText android:id="#+id/db_txtSSHHost"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="SSH Host"
android:singleLine="true"
android:inputType="textNoSuggestions"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText android:id="#+id/db_txtSSHUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="SSH Username"
android:singleLine="true"
android:inputType="textNoSuggestions"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText android:id="#+id/db_txtSSHPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="SSH Password"
android:singleLine="true"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText android:id="#+id/db_txtSSHPort"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="SSH Port"
android:text="22"
android:singleLine="true"
android:inputType="number"/>
</android.support.design.widget.TextInputLayout>
<TextView
android:layout_marginTop="10dp"
android:layout_margin="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
android:text="Leave database blank to connect to any database on this server" />
</LinearLayout>
</ScrollView>
<LinearLayout android:id="#+id/buttonContainer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
style="?android:attr/buttonBarStyle"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom">
<Button android:id="#+id/db_btnTest"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Test Connection" />
<Button android:id="#+id/db_btnCreateEdit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Create"
android:enabled="false" />
</LinearLayout>
<com.google.android.gms.ads.AdView android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
ads:adSize="BANNER"/>
</LinearLayout>
</RelativeLayout>

how to move username and password layout move when touching in android

Hi in the below code i have these layout. once touch inside username edittext i want to move full layout upwards.onfousing the keyboard should be stay like that want to move full layout upwards
Can any one help me
layout
<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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/texture">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="vertical"
android:id="#+id/login">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:paddingTop="100dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#6E6864"
android:text="Sign in to continue"
android:id="#+id/login_tv_sign_continue" />
<EditText
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:paddingLeft="10dp"
android:hint="User Name"
android:id="#+id/login_ed_username"
android:background="#drawable/edit_text_back"
android:imeOptions="actionNext"
android:singleLine="true"
/>
<EditText
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:paddingLeft="10dp"
android:hint="Password"
android:id="#+id/login_ed_password"
android:background="#drawable/edit_text_back"
android:imeOptions="actionDone"
android:singleLine="true"
android:inputType="textPassword"
/>
<Button
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:textColor="#6E6864"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/login_btn_login"
android:text="Sign In"
android:background="#ECBC3B"
/>
<TextView
android:layout_width="300dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/txt_forgetpwd"
android:text="Forgot Password?"
android:gravity="right"
android:layout_marginTop="20dp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/logo"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
/>
</RelativeLayout>
</LinearLayout>
</ScrollView>

Android ScrollView not working properly when use toolbar

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.

Categories

Resources