All Edittext items not displaying in scrollview - android

Name, password1 field not showing up in scrollview
everything else working properly
here is my xml for it..
Made a linear layout after scrollview as it supports only one child.
Any idea what is the problem ?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical" >
<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:layout_gravity="center"
android:orientation="vertical" >
<EditText
android:id="#+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Name" />
<EditText
android:id="#+id/password1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="#string/password"
android:inputType="textPassword" />
<EditText
android:id="#+id/password2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="#string/retype"
android:inputType="textPassword" />
<EditText
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="#string/email"
android:inputType="textEmailAddress" />
<TextView
android:id="#+id/gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Gender" />
<RadioGroup
android:id="#+id/radiogroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RadioButton
android:id="#+id/male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Male" />
<RadioButton
android:id="#+id/female"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Female" />
</RadioGroup>
<ImageView
android:id="#+id/capcha"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<EditText
android:id="#+id/typecaptcha"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Type" />
<Button
android:id="#+id/submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit" />
</LinearLayout>
</ScrollView>
</LinearLayout>

For me the Password field works, seems fine (I copied you XML to test it). If you use eclipse try Project>Clean. I had similar Problems.
Happy Coding
EDIT(Result):

Related

Why is my app rendering only one half of the page?

I have been trying to develop a form in android studio, and I am quite new to xml so not sure what I am doing wrong. Hopefully you can see from below, the preview shows as the boxes taking up basically the full page, however when I render it in a phone it only takes up half the page. Xml code is also below - any ideas would be greatly appreciated? Thanks
XML preview:
Rendered view:
XML Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/RelativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:theme="#style/AppTheme">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/activity_horizontal_margin"
android:orientation="vertical">
<EditText
android:id="#+id/editText10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName" />
<EditText
android:id="#+id/editText7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="Date"
android:inputType="date" />
<EditText
android:id="#+id/editText8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="Time"
android:inputType="time" />
<EditText
android:id="#+id/editText9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="Location"
android:inputType="textPersonName" />
<EditText
android:id="#+id/editText11"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="Tester Notes"
android:inputType="textMultiLine" />
<CheckBox
android:id="#+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Show Notes at appointment" />
<CheckBox
android:id="#+id/checkBox2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Missed Appointment" />
<LinearLayout
android:id="#+id/Buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<Button
android:id="#+id/button3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Save Notes" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Send Email" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<?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/ScrollView01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/Name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/editText10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="60dp"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName" />
</LinearLayout>
<LinearLayout
android:id="#+id/Date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/editText7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:ems="10"
android:hint="Date"
android:inputType="date" />
</LinearLayout>
<LinearLayout
android:id="#+id/Time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/editText8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:ems="10"
android:hint="Time"
android:inputType="time" />
</LinearLayout>
<LinearLayout
android:id="#+id/location"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/editText9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:ems="10"
android:hint="Location"
android:inputType="textPersonName" />
</LinearLayout>
<LinearLayout
android:id="#+id/testernotes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/editText11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_weight="1"
android:ems="10"
android:hint="Tester Notes"
android:inputType="textMultiLine" />
</LinearLayout>
<LinearLayout
android:id="#+id/checkbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<CheckBox
android:id="#+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_weight="1"
android:text="CheckBox" />
</LinearLayout>
<LinearLayout
android:id="#+id/checkBox2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<CheckBox
android:id="#+id/checkBox2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:text="CheckBox" />
</LinearLayout>
<LinearLayout
android:id="#+id/Buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2"
android:orientation="horizontal">
<Button
android:id="#+id/button3"
android:text="button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_weight="1" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Send Email" />
</LinearLayout>
</LinearLayout>
</ScrollView>
please try this xml
layout_weight and its usages was wrong in your xml ,while using layout_weight you have use android:layout_width = "0dp" as per the orientation,
for more info refer
[https://developer.android.com/guide/topics/ui/layout/linear.html][1]
https://blog.stylingandroid.com/layout-weights-part-1/
What does android:layout_weight mean?
much easier implementation
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ScrollView01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical">
<LinearLayout
android:layout_margin="#dimen/activity_horizontal_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/editText10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName" />
<EditText
android:id="#+id/editText7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Date"
android:inputType="date" />
<EditText
android:id="#+id/editText8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Time"
android:inputType="time" />
<EditText
android:id="#+id/editText9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Location"
android:inputType="textPersonName" />
<EditText
android:id="#+id/editText11"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="Tester Notes"
android:inputType="textMultiLine" />
<CheckBox
android:id="#+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="CheckBox" />
<CheckBox
android:id="#+id/checkBox2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="CheckBox" />
<LinearLayout
android:id="#+id/Buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2"
android:orientation="horizontal">
<Button
android:id="#+id/button3"
android:text="button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Send Email" />
</LinearLayout>
</LinearLayout>
</ScrollView>
MATCH_PARENT means that the view wants to be as big as its parent, minus the parent's padding, if any.
Replace this:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
With:
android:layout_width="match_parent"
android:layout_height="wrap_content"
into your LinearLayout.

Android:how to center individual views when layout's gravity is fixed

I am using Linear Layout for this xml file :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
>
<EditText
android:id="#+id/editTextUserNameToLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="User Name">
<requestFocus />
</EditText>
<EditText
android:id="#+id/editTextPasswordToLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Password"
android:inputType="textPassword" />
<Button
android:id="#+id/buttonSignIn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Sign In" />
<ToggleButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New ToggleButton"
android:id="#+id/toggleButton"/>
</LinearLayout>
I want all text views to appear in the center of the screen,
except for the the toggle button which i want it to be in the right-bottom of the screen.
As you can see, i am using android:gravity center in the layout's tag, because neither this nor android:layout_gravity was working on individual textviews.
But now i want toggle button to be independent of this.
How can i achieve it?
test this xml :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center"
android:orientation="vertical" >
<EditText
android:id="#+id/editTextUserNameToLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="User Name" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/editTextPasswordToLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Password"
android:inputType="textPassword" />
<Button
android:id="#+id/buttonSignIn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Sign In" />
</LinearLayout>
<ToggleButton
android:id="#+id/toggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New ToggleButton" />
Just wrap the entire layout into a FrameLayout and keep the toggle button outside of the LinearLayout. then put layout_gravity as you wish. Thats the trick. cheers :)
Try this
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
>
<EditText
android:id="#+id/editTextUserNameToLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="User Name">
<requestFocus />
</EditText>
<EditText
android:id="#+id/editTextPasswordToLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Password"
android:inputType="textPassword" />
<Button
android:id="#+id/buttonSignIn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Sign In" />
</LinearLayout>
<ToggleButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New ToggleButton"
android:layout_gravity="bottom|right"
android:id="#+id/toggleButton"/>
</FrameLayout>
You can use relative layout look this code how you can set your xml as per your requirement.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="#+id/editTextUserNameToLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:layout_centerInParent="true"
android:hint="User Name">
<requestFocus />
</EditText>
<EditText
android:id="#+id/editTextPasswordToLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Password"
android:layout_below="#+id/editTextUserNameToLogin"
android:inputType="textPassword" />
<Button
android:id="#+id/buttonSignIn"
android:layout_width="fill_parent"
android:layout_below="#+id/editTextPasswordToLogin"
android:layout_height="wrap_content"
android:text="Sign In" />
<ToggleButton
android:id="#+id/toggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="New ToggleButton" />
</RelativeLayout>
This is it what you want.
Thanks
check this,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="#+id/editTextUserNameToLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:layout_centerInParent="true"
android:hint="User Name">
<requestFocus />
</EditText>
<EditText
android:id="#+id/editTextPasswordToLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Password"
android:layout_below="#+id/editTextUserNameToLogin"
android:inputType="textPassword" />
<Button
android:id="#+id/buttonSignIn"
android:layout_width="fill_parent"
android:layout_below="#+id/editTextPasswordToLogin"
android:layout_height="wrap_content"
android:text="Sign In" />
<ToggleButton
android:id="#+id/toggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="New ToggleButton" />
</RelativeLayout>

Want to add a scroll view

When I'm trying to add ScrollView its giving me error that Scroll view can contain only a single child. So how to add a ScrollView ?
And also when I open my app in various phones all the phones gives different layouts. How do manage the look and feel of the app same for all mobile devices ?
Register.xml
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0066CC"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="#+id/upImage"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#000"
android:layout_gravity="center_horizontal"/>
<TextView
android:id="#+id/textView1"
android:layout_width="465dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_weight="0.02"
android:layout_marginBottom="100dp"
android:textSize="15sp"
android:textStyle="bold"
android:text="Tap to upload Profile Picture" />
<EditText
android:id="#+id/imName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:hint="Enter name of the Image"
android:ems="10" >
</EditText>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name" />
<EditText
android:id="#+id/etName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age" />
<EditText
android:id="#+id/etAge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username" />
<EditText
android:id="#+id/etUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password" />
<EditText
android:id="#+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:inputType="textPassword" />
<Button
android:id="#+id/bRegister"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Register" />
</LinearLayout>
Yes ScrollView allow only single child
So put you parent LinearLayout inside ScrollView like below
<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"
android:background="#0066CC"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="#+id/upImage"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#000"
android:layout_gravity="center_horizontal"/>
<TextView
android:id="#+id/textView1"
android:layout_width="465dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_weight="0.02"
android:layout_marginBottom="100dp"
android:textSize="15sp"
android:textStyle="bold"
android:text="Tap to upload Profile Picture" />
<EditText
android:id="#+id/imName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:hint="Enter name of the Image"
android:ems="10" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name" />
<EditText
android:id="#+id/etName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Age" />
<EditText
android:id="#+id/etAge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username" />
<EditText
android:id="#+id/etUsername"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password" />
<EditText
android:id="#+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:inputType="textPassword" />
<Button
android:id="#+id/bRegister"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Register" />
</LinearLayout>
</ScrollView>
Android only supports a single child inside a ScrollView. The simplest way is to enclose everything inside a LinearLayout and make it a child of a ScrollView.
If you however want to maintain the same look and feel throughout the application, try using a RelativeLayout instead of the LinearLayout as the child of the ScrollView.

Keyboard and scrollviews

I have an activity with a form. I put all views in a ScrollView because when the keyboard opens, I would scroll through the fields.
When the keyboard opens, the first field goes over the top of the ScrollView and becomes unreachable.
This is the 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="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<EditText
android:id="#+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="Username"
android:inputType="text|textEmailAddress"
android:singleLine="true" />
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="Password"
android:inputType="textPassword"
android:singleLine="true" />
<EditText
android:id="#+id/password1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:hint="#string/repeat_password"
android:inputType="textPassword"
android:singleLine="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/gender" />
<RadioGroup
android:id="#+id/gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="5dp">
<RadioButton
android:id="#+id/male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="M" />
<RadioButton
android:id="#+id/female"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="F" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/age" />
<EditText
android:id="#+id/age"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number"
android:paddingLeft="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/education" />
<Spinner
android:id="#+id/education"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp" />
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:onClick="salva"
android:text="#string/save" />
</LinearLayout>
</ScrollView>
This is the activity definition in the manifest:
<activity
android:name=".activities.SignUpActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/title_activity_sign_up">
</activity>
This is a screenshot. The username field is unreachable! (look at the scrollbar on the right)
Use following in your App Manifest
android:windowSoftInputMode="stateHidden|adjustPan"
For more details you can visit here
http://developer.android.com/guide/topics/manifest/activity-element.html
In your activity manifest entry add this:
android:windowSoftInputMode="stateVisible|adjustPan".
I've found the solution. The problem was this line:
android:layout_gravity="center"
I just removed it from the layout file. The manifest was correct.

How to create layout for registration mobile number

http://snag.gy/0kz5e.jpg please look this Image I have to create layout but
I am unable to do this there is some Problem with android control set on particular.
I am able to display controls in android:gravity bottom but my controls is not fix like image please check what I am missing where am doing wrong .
here is my Xml file code:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/registraionimage" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="132dp"
android:layout_gravity="bottom"
android:orientation="vertical" >
<Spinner
android:id="#+id/spinner1"
android:layout_width="match_parent"
android:layout_height="49dp"
android:entries="#array/country_arrays"
android:prompt="#string/country_prompt" />
<LinearLayout
android:id="#+id/layout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="#+id/editText1"
android:layout_width="94dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number"
android:text="Code" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="phone"
android:text="Phone" />
</LinearLayout>
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/layout1"
android:text="Next"
android:textColor="#0066FF"
android:textStyle="bold" />
</LinearLayout>
</FrameLayout>
Can you just try below code, I replace FrameLayout to RelativeLayout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/main_background" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:background="#android:color/transparent"
android:orientation="vertical" >
<Spinner
android:id="#+id/spinner1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:id="#+id/layout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<EditText
android:id="#+id/editText1"
android:layout_width="94dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number"
android:text="Code" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="phone"
android:text="Phone" />
</LinearLayout>
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Next"
android:textColor="#0066FF"
android:textStyle="bold" />
</LinearLayout>

Categories

Resources