Android Scroll view is not working when keyboard comes - android

scroll view is working without keyboard But it is not working when keyboard comes i have also tried "android:windowSoftInputMode="adjustResize|stateHidden" no use i dont understand please explain what is happening `
<?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="fill_parent"
android:fillViewport="true"
android:background="#drawable/background"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="vertical"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_gravity="center_horizontal"
android:layout_weight=".85"
android:background="#drawable/logo" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight=".15"
android:gravity="center"
android:text="Fill in the below to get Started"
android:textColor="#FFFFFF" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp">
<EditText
android:id="#+id/sig_user"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_gravity="center_horizontal"
android:layout_margin="3dp"
android:layout_weight=".5"
android:background="#drawable/rounder_edittext"
android:hint=" User name"
android:inputType="textEmailAddress"
android:drawableStart="#drawable/user"
android:drawablePadding="10dp"
android:padding="10dp"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#android:color/white"
android:textSize="18sp"
android:drawableLeft="#drawable/user" />
<EditText
android:id="#+id/sig_password"
android:layout_width="match_parent"
android:layout_height="55dp"
android:drawableStart="#drawable/lock"
android:drawablePadding="10dp"
android:padding="15dp"
android:layout_gravity="center_horizontal"
android:layout_margin="3dp"
android:layout_weight=".5"
android:background="#drawable/rounder_edittext"
android:hint=" Password"
android:inputType="textPassword"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#android:color/white"
android:textSize="18sp"
android:drawableLeft="#drawable/user" />
<EditText
android:id="#+id/sig_email"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_gravity="center_horizontal"
android:layout_margin="3dp"
android:layout_weight=".5"
android:background="#drawable/rounder_edittext"
android:hint=" E-mail"
android:inputType="textEmailAddress"
android:drawableStart="#drawable/mail"
android:drawablePadding="10dp"
android:padding="10dp"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#android:color/white"
android:textSize="18sp"
android:drawableLeft="#drawable/user" />
<EditText
android:id="#+id/sig_phone"
android:layout_width="match_parent"
android:layout_height="55dp"
android:drawableStart="#drawable/phone"
android:drawablePadding="10dp"
android:padding="15dp"
android:layout_gravity="center_horizontal"
android:layout_margin="3dp"
android:layout_weight=".5"
android:background="#drawable/rounder_edittext"
android:hint=" Phone"
android:inputType="textPassword"
android:singleLine="true"
android:textColor="#FFFFFF"
android:textColorHint="#android:color/white"
android:textSize="18sp"
android:drawableLeft="#drawable/user" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="#+id/signup"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginTop="10dp"
android:background="#drawable/white_button"
android:text="creat account"
android:textColor="#f29925" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
`

Add android:windowSoftInputMode="stateHidden|adjustResize" to your tag in AndroidManifest.xml file. This will cause the screen to be resized to the left over space after the soft keyboard is shown. So, you will be able to scroll easily.
In Manifest.xml file like this.
<activity android:name="MyActivity"
android:label="#string/app_name"
android:windowSoftInputMode="stateHidden|adjustResize"
>

Related

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.

Strange padding not happening on layout in Android

I am creating a registration screen strangely I am facing an issue with padding a layout which has sign up text.
I would like to align it according to text box shown in the screen shot below. I am not sure why this giving me this strange issue?
Below is the code I have tried:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/backgroundcolor"
android:orientation="vertical" >
<TextView
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp"
android:text="#string/signUp"
android:textColor="#000000"
android:textSize="20sp" />
<LinearLayout
android:id="#+id/linearlayout1"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="#+id/header"
android:padding="10dp" >
<EditText
android:id="#+id/namefEDIT"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/textbox"
android:hint="#string/fname"
android:padding="5dp"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearlayout2"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="#+id/fnamelinearlayout"
android:padding="10dp" >
<EditText
android:id="#+id/namelEDIT"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/textbox"
android:hint="#string/lname"
android:padding="5dp"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearlayout3"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="#+id/lnamelinearlayout"
android:padding="10dp" >
<EditText
android:id="#+id/numberEDIT"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/textbox"
android:hint="#string/mobilenumber"
android:inputType="numberSigned"
android:padding="5dp"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearlayout4"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="#+id/mobilelinearlayout"
android:padding="10dp" >
<EditText
android:id="#+id/pEDIT"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/textbox"
android:hint="#string/password"
android:inputType="textPassword"
android:padding="5dp"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearlayout5"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="#+id/passwordlinearlayout"
android:layout_marginTop="15dp"
android:background="#drawable/button_selector"
android:orientation="vertical" >
<TextView
android:id="#+id/textEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_vertical"
android:padding="10dp"
android:textSize="20sp"
android:text="#string/signText"
android:textColor="#000000" />
</LinearLayout>
</RelativeLayout>
Below is the screen shot:
This layout should do the same:
<TextView
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp"
android:text="#string/signUp"
android:textColor="#000000"
android:textSize="20sp" />
<EditText
android:id="#+id/namefEDIT"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/textbox"
android:hint="#string/fname"
android:padding="5dp"
android:layout_margin="10dp"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="20sp" />
<EditText
android:id="#+id/namelEDIT"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/textbox"
android:hint="#string/lname"
android:padding="5dp"
android:layout_margin="10dp"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="20sp" />
<EditText
android:id="#+id/numberEDIT"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/textbox"
android:hint="#string/mobilenumber"
android:inputType="numberSigned"
android:padding="5dp"
android:layout_margin="10dp"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="20sp" />
<EditText
android:id="#+id/pEDIT"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/textbox"
android:hint="#string/password"
android:inputType="textPassword"
android:padding="5dp"
android:layout_margin="10dp"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="20sp" />
<TextView
android:id="#+id/textEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center_vertical"
android:padding="10dp"
android:layout_margin="10dp"
android:textSize="20sp"
android:text="#string/signText"
android:textColor="#000000" />
</LinearLayout>

Black Background When Click On EditText

![enter image description here][1]In android we Create a RetailerRegistration form when softkeyboard open then bottom field are hide so we use on scrollview but when we use scrollview and click on edittext then softkeyboard open and whole screen turn on black how to resolve it please suggest
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff">
<LinearLayout
android:orientation="vertical"
android:minHeight="40px"
android:layout_width="match_parent"
android:layout_height="1.0dp"
android:id="#+id/linearLayout1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/linearLayout2">
<TextView
android:text="Retailer Name"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:id="#+id/textViewretailerName"
android:gravity="left"
android:cacheColorHint="#00000000"
style="#style/TextView_Small" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTextretailername"
android:gravity="left"
style="#style/EditText_Small2"
android:maxLength="30"
android:inputType="textCapCharacters"
android:editable="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/linearLayout18">
<TextView
android:text="Mobile No."
android:layout_width="110dp"
android:layout_height="wrap_content"
android:id="#+id/textViewretailerMobileNo"
android:gravity="left"
android:cacheColorHint="#00000000"
style="#style/TextView_Small" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTextretailerMobile"
android:gravity="left"
style="#style/EditText_Small2"
android:maxLength="10"
android:inputType="number"
android:editable="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/linearLayout3">
<TextView
android:text="Address"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:id="#+id/textViewretailerAddress"
android:gravity="left"
android:cacheColorHint="#00000000"
style="#style/TextView_Small" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTextretaileraddress1"
android:gravity="left"
android:minLines="2"
style="#style/EditText_Small2"
android:maxLength="100"
android:inputType="textCapCharacters"
android:editable="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/linearLayout3">
<TextView
android:text=""
android:layout_width="110dp"
android:layout_height="wrap_content"
android:id="#+id/textViewretailerAddress1"
android:gravity="left"
android:cacheColorHint="#00000000"
style="#style/TextView_Small" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTextretaileraddress2"
android:gravity="left"
android:minLines="2"
style="#style/EditText_Small2"
android:maxLength="100"
android:inputType="textCapCharacters"
android:editable="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/linearLayout4">
<TextView
android:text="PinCode"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:id="#+id/textViewretailerzipcode"
android:gravity="left"
android:cacheColorHint="#00000000"
style="#style/TextView_Small" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTextretailerzipcode"
android:gravity="left"
style="#style/EditText_Small2"
android:maxLength="6"
android:inputType="number"
android:editable="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/linearLayout5">
<TextView
android:text="Town"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:id="#+id/textViewretailercity"
android:gravity="left"
android:cacheColorHint="#00000000"
style="#style/TextView_Small" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTextretailercity"
android:gravity="left"
style="#style/EditText_Small2"
android:maxLength="50"
android:inputType="textCapCharacters"
android:editable="true" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/linearLayout6">
<TextView
android:text="District"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:id="#+id/textViewretailerdistrict"
android:gravity="left"
android:cacheColorHint="#00000000"
style="#style/TextView_Small" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTextretailerdistrict"
android:gravity="left"
style="#style/EditText_Small2"
android:maxLength="50"
android:inputType="textCapCharacters"
android:editable="false" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="#+id/linearLayout7">
<TextView
android:text="State"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:id="#+id/textViewretailerstate"
android:gravity="left"
android:cacheColorHint="#00000000"
style="#style/TextView_Small" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTextretailerState"
android:gravity="left"
style="#style/EditText_Small2"
android:maxLength="50"
android:inputType="textCapCharacters"
android:editable="false" />
</LinearLayout>
</LinearLayout>
</ScrollView>
try this Link for screenshot
http://i.stack.imgur.com/13vOw.png
I am not sure but it works fine for me.
Make your main Layout Relative "Relative Layout".
and Inside this Layout add your "Scroll View".

Input text field doesn't display text being typed on Gingerbread and below?

I have a edit text for the given xml file
<?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:background="#drawable/mainbg"
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="wrap_content"
android:layout_weight=".5"
android:orientation="vertical" >
<EditText
android:id="#+id/user_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="0.1"
android:ems="10"
android:hint="Full Name"
android:singleLine="true"
/>
<EditText
android:id="#+id/user_add"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:ems="10"
android:gravity="top"
android:hint="Address"
android:inputType="textMultiLine"
android:ellipsize="end"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight=".1" >
<Button
android:id="#+id/user_area"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="30"
android:hint="Area"
android:textColor="#006999"
android:textCursorDrawable="#null" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="17"
android:orientation="vertical" >
</LinearLayout>
<EditText
android:id="#+id/user_city"
android:layout_width="141dp"
android:layout_height="match_parent"
android:layout_weight=".5"
android:ems="10"
android:hint="City"
android:textColor="#006999"
android:textCursorDrawable="#null" >
<requestFocus />
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".4"
android:orientation="vertical" >
<EditText
android:id="#+id/user_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:ems="10"
android:hint="Email"
android:textColor="#006999"
android:textCursorDrawable="#null" />
<EditText
android:id="#+id/user_phone_no"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:ems="10"
android:hint="Phone Number"
android:inputType="number"
android:textColor="#006999"
android:textCursorDrawable="#null" />
<EditText
android:id="#+id/user_its_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:ems="10"
android:hint="ITS/Ejamaat Number"
android:inputType="number"
android:textColor="#006999"
android:textCursorDrawable="#null" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:orientation="vertical" >
</LinearLayout>
<RelativeLayout
android:id="#+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:gravity="center" >
<Button
android:id="#+id/btn_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save"
>
</Button>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
It is working perfectly fine in ICS and JellyBean but in Gingerbread/Froyo etc the edit text is not editable(whatever user inputs does not show in the edit text) . I have no clue for this wierd behaviour .
please help
Don't know why you are getting this weird issue, I had tested your code on Android 2.2 Froyo with API 8 and it was working flawlessly. If you are testing on simulator i suggest to uninstall your app from the simulator than again try to deploy and test it.
Please Try this code on device it issues in simulator. Dont be panic for this code.

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