<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<VideoView
android:id="#+id/uploadedVideo"
android:layout_width="match_parent"
android:layout_height="224dp" />
<TextView
android:id="#+id/tvPath"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/uploadedVideo"
android:padding="5dp"
android:lines="1"
android:hint="choose video"/>
<EditText
android:id="#+id/etTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/tvPath"
android:hint="Your title here"/>
<EditText
android:id="#+id/etDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/etTitle"
android:hint="Your description here"/>
<Button
android:id="#+id/btnUpload"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="upload"/>
</RelativeLayout>
</ScrollView>
</LinearLayout>
I created a layout as above. The problem here is, when I click the edit texts and the keyboard comes out, the scroll view is stretched only little so the edit texts are hidden by the keyboard. The button moves above the keyword, but again it's the two edit texts that are hidden by the keyboard.
Keeping Scrollview as parent is making both editText visible when the keyboard is up.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<VideoView
android:id="#+id/uploadedVideo"
android:layout_width="match_parent"
android:layout_height="224dp" />
<TextView
android:id="#+id/tvPath"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/uploadedVideo"
android:padding="5dp"
android:lines="1"
android:hint="choose video"/>
<EditText
android:id="#+id/etTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/tvPath"
android:hint="Your title here"/>
<EditText
android:id="#+id/etDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/etTitle"
android:hint="Your description here"/>
<Button
android:id="#+id/btnUpload"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="upload"/>
</LinearLayout>
</ScrollView>
Related
I was trying to make a lower navigation bar and because the views where a lot I needed to use a scroll view but the problem is that the last element in the scroll view doesn't appear because of the navigation bar.
so what can I do to make last element appear??
my xml code is :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="#E6E6E6"
android:layout_height="match_parent"
tools:context=".mainPage">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
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:layout_margin="16dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:fontFamily="#font/lato_bold"
android:text="Servings"
android:textColor="#color/purple_700"
android:textSize="20sp" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:inputType="number"
android:id="#+id/servings"
android:hint="Servings that you will eat"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:fontFamily="#font/lato_bold"
android:text="grams per serving"
android:textColor="#color/purple_700"
android:textSize="20sp" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:inputType="number"
android:id="#+id/grams"
android:hint="grams per serving"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:fontFamily="#font/lato_bold"
android:text="calories for each serving"
android:textColor="#color/purple_700"
android:textSize="20sp" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:inputType="number"
android:id="#+id/calories"
android:hint="calories for each serving"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:fontFamily="#font/lato_bold"
android:text="meal name"
android:textColor="#color/purple_700"
android:textSize="20sp" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:inputType="text"
android:id="#+id/name"
android:hint="type the meal name"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="#+id/add"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:fontFamily="#font/lato_bold"
android:text="Add"
android:textSize="14sp" />
<Button
android:id="#+id/dont"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:fontFamily="#font/lato_bold"
android:text="Don’t know how many calories are in this meal ?"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<Button
android:id="#+id/main_food"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:fontFamily="#font/lato_bold"
android:text="What have you eaten today"
android:textSize="14sp" />
<Button
android:id="#+id/adding_food"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:fontFamily="#font/lato_bold"
android:text="Food Adding"
android:textSize="14sp" />
<Button
android:id="#+id/profile_food"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:fontFamily="#font/lato_bold"
android:text="Profile"
android:textSize="14sp" />
</LinearLayout>
</RelativeLayout>
so how can I make the last element in the scroll view because the navigaion bar is blocking it (it's in the front of it so the last element doesn't show.
This is an image of it and as you can see the navigation bar is in the front of the last element so it doesn't show because of that
Add id to Bottom navigation bar LinearLayout
Add android:layout_above="#+id/yourbottomlayoutid" , android:layout_height="match_parent" and android:fillViewport="true" to your ScrollView.
For reference check below code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:background="#E6E6E6"
android:layout_height="match_parent"
tools:context=".mainPage">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_above="#+id/llBottomBar">
<!--Your LinearLayout-->
</ScrollView>
<LinearLayout
android:id="#+id/llBottomBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<!--Bottom navigation bar buttons-->
</LinearLayout>
</RelativeLayout>
Add android:paddingBottom = "Xdp", where X is something bigger than your bottom bar, to the last LinearLayout.
Example: android:paddingBottom = "30dp"
Is it possible to scroll to a button that aligned to the bottom of the layout when keyboard is overlaying the button when windowSoftInputMode="adjustPan"?
I don't want to use windowSoftInputMode="adjustResize" because I want the button to be under the keyboard, and I want to scroll to the button when keyboard is opened.
Example layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="#+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:layout_width="match_parent"
android:layout_height="70dp"
android:hint="edit text" />
<EditText
android:layout_width="match_parent"
android:layout_height="70dp"
android:hint="edit text" />
</LinearLayout>
</ScrollView>
<Button
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:text="button" />
</RelativeLayout>
I need to scroll to the button that is under the keyboard:
Try this add android.support.v4.widget.NestedScrollView instead of Relativelayout and make android:transcriptMode="alwaysScroll" always Scroll
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
<ScrollView
android:id="#+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:transcriptMode="alwaysScroll">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:layout_width="match_parent"
android:layout_height="70dp"
android:hint="edit text" />
<EditText
android:layout_width="match_parent"
android:layout_height="70dp"
android:hint="edit text" />
<Button
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:text="button" />
</LinearLayout>
</ScrollView>
</android.support.v4.widget.NestedScrollView>
So I've been designing in XML in Android Studio a standard log in page - with an image covering about half of the screen, and then the edit text fields occupying the bottom half, asking for the log in details. My problem is that when I tap on the edit text fields on smaller mobile displays, it will only snap to and show the field I have selected, when I think it's far better if it were to automatically snap to show all fields and the 'Next' button at once.
An overview of the page
When I click on 'UserID' field
What I WANT to see when I click on 'UserID' field
How do I achieve this result?
<LinearLayout 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:gravity="center_horizontal"
android:orientation="vertical"
tools:context="com.example.android.brunelplanner.LoginActivity">
<!-- Login progress -->
<ProgressBar
android:id="#+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ScrollView
android:id="#+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/logo"
android:layout_width="match_parent"
android:layout_height="250sp"
android:background="#color/colorPrimary"
android:orientation="vertical"></LinearLayout>
<RelativeLayout
android:id="#+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/logo"
android:orientation="vertical">
<LinearLayout
android:id="#+id/login_fields"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.87"
android:gravity="center"
android:text="eVision Log in"
android:textColor="#000000"
android:textSize="20sp" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/prompt_userID"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/prompt_password"
android:imeActionId="#+id/login"
android:imeActionLabel="#string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/login_fields">
<Button
android:id="#+id/email_sign_in_button"
style="?android:textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="#string/action_sign_in"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
Cant comment so I have to write here. If you XML in question is current, you have to align parent bottom the whole layout that you want to move up. The bottom alignment must have the whole login form not just button. Also you have linear layout on top which has fixed height, that could be a problem too.
EDIT: Ok, try this, it works on my end. BUT I simplified the XML for testing so dont copy it, just try to edit your xml.
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/logo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/email_login_form"
android:layout_alignParentTop="true"
android:background="#color/colorPrimary"
android:orientation="vertical">
</LinearLayout>
<RelativeLayout
android:id="#+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true">
<LinearLayout
android:id="#+id/login_fields"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.87"
android:gravity="center"
android:text="eVision Log in"
android:textColor="#000000"
android:textSize="20sp" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/email_login_form"
android:layout_alignParentBottom="true">
<Button
android:id="#+id/email_sign_in_button"
style="?android:textAppearanceSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:text="sign in"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
When I rotate my screen to landscape mode, a DialogFragment containing this layout is cutting off the two buttons at the bottom:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="4dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Alias"/>
<EditText
android:id="#+id/edittext_alias"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:ems="10"
android:layout_marginLeft="4dp"
android:maxLength="30"
android:imeOptions="actionDone"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Interests"/>
<EditText
android:id="#+id/edittext_interests"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:ems="10"
android:layout_marginLeft="4dp"
android:maxLength="10"
android:imeOptions="actionDone"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bio"/>
<EditText
android:id="#+id/edittext_bio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapSentences"
android:ems="10"
android:layout_marginLeft="4dp"
android:maxLines="2"
android:gravity="top"
android:imeOptions="actionDone"
android:requiresFadingEdge="vertical"
android:fadingEdgeLength="20dp"
android:scrollbars="vertical"
android:fadeScrollbars="false"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="#+id/button_cancel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="Cancel"
android:layout_weight="1"/>
<Button
android:id="#+id/button_confirm"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="OK"
android:layout_gravity="center_horizontal"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
Am I doing something wrong or missing something obvious? How can I get it to force display everything?
I think the case is your screen is simply not large enough to show the whole content. Android does not add the scroll functionality if content is larger then the screen. If this is the case wrap all your views in a ScrollView so that the buttons could be visible after scrolling. Like this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="4dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Putt all your view here -->
</LinearLayout>
</ScrollView>
</LinearLayout>
Also you may put ScrollView as Your Parent View
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Putt all your view here -->
</LinearLayout>
</ScrollView>
I have a main ScrollView and then I have a child LinearLayout and that has ListView in it. I'm not sure why it is not scrolling. I read about how listview should not be inside scroll view, but I need my layout to scroll and then view the listview. I'm not sure if this is the proper approach. Please direct.
This works on my tablet with a large screen but not on my phone which has a smaller screen and you need to scroll to view the listview completely. The listview works if I use linear layout but then I don't see the listview completely because its on the bottom of the layout.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fitsSystemWindows="true" >
<LinearLayout
android:id="#+id/user_info"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:paddingTop="46dp"
android:paddingLeft="24dp"
android:paddingRight="24dp" >
<Spinner
android:id="#+id/userTypeSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
<EditText android:id="#+id/fname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:hint="First Name"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp" >
<EditText android:id="#+id/lname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:hint="Last Name"/>
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:id="#+id/staff_username"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone" >
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp" >
<EditText android:id="#+id/uname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:hint="Username"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/staff_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone" >
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp" >
<EditText android:id="#+id/upassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:hint="Password"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/staff_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone" >
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp" >
<EditText android:id="#+id/uemail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:hint="Email"/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/staff_permissions"
android:layout_marginTop="8dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
>
<ListView
android:id="#+id/permission_list"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:fadeScrollbars="false"
/>
</LinearLayout>
<android.support.v7.widget.AppCompatButton
android:id="#+id/addUserBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginBottom="24dp"
android:padding="12dp"
android:text="#string/add_new_user"/>
</LinearLayout>
Same problem i had. This is my code. Check it out.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/login_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/login"
android:gravity="center"
android:orientation="vertical" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="250dp"
android:layout_height="270dp"
android:layout_marginTop="40dp"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/username_login" />
<EditText
android:id="#+id/username_login"
android:layout_width="200dp"
android:layout_height="30dp"
android:background="#drawable/edit_text"
android:inputType="text"
android:paddingLeft="5dp"
android:paddingTop="2dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/password_login" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Don't use scrollview as a parent. Just take scrollview inside parent layout i.e. LinearLayout or RelativeLayout.
Try to replace your ListView with LinearLayout and add same items(views) in this which you want to add in your listview