Keyboard keeps blocking my view... how to fix it? - android

my keyboard keeps blocking my view. Is there anyway to fix this?
When I click the Description 2 to insert something, But the keyboard so annoying... I can't see what I'm typing... Actually This isn't one page. Others page also like this. I can't see what I'm typing, Only when I close the keyboard then okay can see the things.
Here is the code
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|top">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ListView
android:id="#+id/listView1"
android:layout_width="match_parent"
android:layout_height="300dp"></ListView>
</LinearLayout>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:text="DATE:" />
<TextView
android:id="#+id/Select_Date"
android:layout_width="60dp"
android:layout_height="38dp"
android:text="SELECT DATE"
android:textSize="19dp"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:text="TXN NO:" />
<TextView
android:id="#+id/D_Txn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:text="NAME:" />
<EditText
android:id="#+id/D_Name"
android:layout_width="273dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="72dp"
android:layout_height="wrap_content"
android:text="AMOUNT:" />
<EditText
android:id="#+id/D_Amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="number" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="110dp"
android:layout_height="wrap_content"
android:text="DESCRIPTION1:" />
<Spinner
android:id="#+id/D_Description"
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="#android:drawable/btn_dropdown"
android:spinnerMode="dropdown" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:text="DESCRIPTION2:" />
<EditText
android:id="#+id/Ds_Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName" />
</TableRow>
</TableLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:gravity="center|bottom"
android:orientation="horizontal">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableRow>
<Button
android:textColor="#color/my_color_state"
android:id="#+id/Db_New"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="NEW" />
<Button
android:textColor="#color/my_color_state"
android:id="#+id/Db_Save"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:enabled="false"
android:text= "SAVE" />
</TableRow>
<TableRow>
<Button
android:textColor="#color/my_color_state"
android:id="#+id/Db_Print"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="PRINT" />
<Button
android:textColor="#color/my_color_state"
android:id="#+id/Db_Back"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="BACK" />
</TableRow>
</TableLayout>
</LinearLayout>

In your manifest, add this line to your activity:
android:windowSoftInputMode="adjustResize"
It adjusts your activity when the available layout size changes.
EDIT:
You'll also have to add a ScrollView over the main container in your case.

Go to your Manifest and add this line for the selected activity
android:windowSoftInputMode="adjustPan"
Example:
<activity
android:name=".Activity.MainActivity"
android:label="#string/title_activity_main"
android:windowSoftInputMode="adjustPan">

Related

Make the control in LinearLayout not to fill all the space

I have a layout like this:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="fsfsdfds"
android:layout_gravity="center_vertical" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="fdsfdsfds"
android:layout_gravity="center_vertical" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content" />
It fill the whole space of the activity.
How can I make these 2 TextViews and EditTexts take only space enough to show themselves (not fill all the space) and align the button to the bottom?
I think this is what you're looking for :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="TextView1" />
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:inputType="text" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/LinearLayout1"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="TextView2" />
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:inputType="text" />
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Button" />
</RelativeLayout>
EDIT :
If you don't want to use the two LinerLayouts (and therefore gain even more performance), you can do the following :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/TextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#id/EditText1"
android:layout_gravity="center_vertical"
android:text="TextView1" />
<EditText
android:id="#+id/EditText1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="center_vertical"
android:layout_toEndOf="#id/TextView1"
android:layout_toRightOf="#id/TextView1"
android:inputType="text" />
<TextView
android:id="#+id/TextView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#id/EditText2"
android:layout_below="#id/TextView1"
android:layout_gravity="center_vertical"
android:text="TextView2" />
<EditText
android:id="#+id/EditText2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="#id/EditText1"
android:layout_gravity="center_vertical"
android:layout_toEndOf="#id/TextView2"
android:layout_toRightOf="#id/TextView2"
android:inputType="text" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Button" />
</RelativeLayout>
Check This.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.5"
android:text="fsfsdfds" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.5" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.5"
android:text="fdsfdsfds" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.5" />
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content" />
You try with RelativeLayout, or else if wanted to be done with LinearLayout you need to consider weights if width is not fillparent.
Check below sample to start with ..
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.2"
android:text="fsfsdfds" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.8" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.2"
android:text="fdsfdsfds" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.8" />
Either convert to a relative-layout and use alignparentbottom for the button - or use layout weights for the linear-layouts

Move a single element above the keyboard

I would like to move a single element (relative layout) of my layout above the software keyboard when an editText is focused.
I've tried to set android:windowSoftInputMode with adjustResize in my manifest but as I seen in many other stackoverflow questions it works only with the entire Activity.
So, is it possible to move a single element above the keyboard?
I hope the following sample helps.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
<ScrollView android:id="#+id/scrollView1" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_weight="1">
<LinearLayout android:id="#+id/linearLayout1" android:layout_width="match_parent"
android:layout_height="match_parent" android:orientation="vertical">
<EditText android:id="#+id/editText1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="EditText1" />
<EditText android:id="#+id/editText2" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="EditText2" />
<EditText android:id="#+id/editText3" android:layout_height="wrap_content"
<EditText android:id="#+id/editText4" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="EditText4" />
<EditText android:id="#+id/editText5" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="EditText5" />
<EditText android:id="#+id/editText6" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="EditText6" />
<EditText android:id="#+id/editText7" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="EditText7" />
<EditText android:id="#+id/editText8" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="EditText8" />
<EditText android:id="#+id/editText9" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="EditText9" />
</LinearLayout>
</ScrollView>
<LinearLayout style="#android:style/ButtonBar" android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="horizontal">
<Button android:id="#+id/button1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1"
android:text="Button"></Button>
</LinearLayout>
</LinearLayout>
http://www.androidpub.com/?document_srl=1703090&mid=android_dev_qna&comment_srl=1704523&rnd=1704523#comment_1704523

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.

Cannot scroll up when layout is centered in the parent

I have a scroll view containing a Linearlayout which contains some controls.
The controls has to be centered in the main view, so I wrapped the scroll view with a RelativeLayout and set the android:layout_centerInParent="true" which works fine.
The problem is that when I try to enter a text in the first Edittext and the tablet is in landscape mode and the keyboard appears, then the Editbox disappears and you are not able to scroll up to see the first Editbox. (I think the reason is the android:layout_centerInParent="true")
How can I solve this problem to be able to scroll up and down to see all the controls when the keyboard appears.
The Layout file is the following:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/relativeLayout1">
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="12dp"
android:paddingBottom="20dp"
android:scrollbarStyle="outsideOverlay"
android:layout_centerInParent="true" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center">
<LinearLayout
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="0dp"
android:layout_height="0dp"
android:id="#+id/LayoutDummy" />
<TextView
android:text="#string/Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/textView4" />
<EditText
android:inputType="textPersonName"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/EdName" />
<TextView
android:text="#string/Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/textView4" />
<EditText
android:inputType="textPersonName"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/EdName" />
<TextView
android:text="#string/Password"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/textView5" />
<EditText
android:inputType="textPassword"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/EdPassword" />
<TextView
android:text="#string/Mandant"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/textView5" />
<EditText
android:inputType="numberSigned"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/EdMandant" />
<EditText
android:inputType="textNoSuggestions"
android:layout_width="359.2dp"
android:layout_height="wrap_content"
android:id="#+id/EdLoginUrl"
android:layout_marginTop="11.6dp" />
<CheckBox
android:text="Offline"
android:id="#+id/cbOffline"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="7.9dp" />
<TableLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/tableLayout1"
android:paddingTop="20dp">
<TableRow
android:id="#+id/tableRow1"
android:layout_gravity="center_horizontal"
android:gravity="center">
<Button
android:text="Ok"
android:id="#+id/BtnOk"
android:layout_column="0"
android:layout_width="100dp" />
<Button
android:text="Cancel"
android:layout_column="1"
android:id="#+id/BtnCancel"
android:layout_width="100dp" />
</TableRow>
</TableLayout>
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/linearLayout1"
android:paddingTop="20dp">
<Button
android:id="#+id/BtnSetting"
android:layout_height="36dp"
android:layout_width="36dp"
android:layout_gravity="center"
android:background="#drawable/ic_action_settings"
android:gravity="top" />
<TextView
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/txtResult"
android:gravity="center"
android:paddingTop="20dp" />
</LinearLayout>
</LinearLayout></ScrollView></RelativeLayout>
try using linear layout instead of relative layout with
android:layout_gravity="center"
Try putting
android:windowSoftInputMode="adjustResize"
inside your activity defined in manifest file.

Android TableLayout: Trying to make entried in 1 row larger than another

I have the following layout in my application
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow>
<TextView
android:text="Username"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:id="#+id/username"
android:inputType="textEmailAddress"
/>
</TableRow>
<TableRow>
<TextView
android:text="Password"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:id="#+id/password"
android:inputType="textPassword"
/>
</TableRow>
<!-- ADDED NEW -->
<TableRow
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/savePwd"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:text="Save Password (In encrypted clear text)"
/>
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:text="Please Log In"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/message_login"/>
</TableRow>
<TableRow android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="bottom|center">
<Button
android:id="#+id/btn_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Log In"/>
</TableRow>
</TableLayout>
The problem here is around the EditTexts. The TextViews expand to match the LinearLayout. This is not what I would like. I would like it to behave like the button below it (which doesn't expand the TextViews). Here is a screenshot...
Before...
After
Since you are using weights on the Edit Texts, remove the android:layout_width="wrap_content" from the Edit Texts, and the weight will be extended how you like.
This Rows for the TextViews/EditText should look like this instead....
<TableRow>
<TextView
android:text="Password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0" />
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2.0"
android:id="#+id/password"
android:inputType="textPassword"
/>
</TableRow>
// try 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:padding="5dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<TextView
android:text="Username"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="#+id/username"
android:layout_marginLeft="5dp"
android:inputType="textEmailAddress"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<TextView
android:text="Password"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="#+id/password"
android:layout_marginLeft="5dp"
android:inputType="textPassword"/>
</LinearLayout>
<!-- ADDED NEW -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/savePwd"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="5dp"
android:text="Save Password (In encrypted clear text)"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<TextView
android:text="Please Log In"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/message_login"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="bottom|center"
android:layout_marginTop="5dp"
android:layout_weight="1">
<Button
android:id="#+id/btn_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Log In"/>
</LinearLayout>
</LinearLayout>

Categories

Resources