I have a login screen as shown in the picture.
When the soft key comes it hides the Login button. I need the button moves to the top of the soft key so that the user can click after entering the id and password.
Below is the layout......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#drawable/background" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="50dp" >
<EditText
android:id="#+id/email_mob_edit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="E-MAIL"
android:layout_marginBottom="-1dp"
android:singleLine="true"
android:background="#drawable/edit_text_top_boarder"
android:paddingLeft="5dp"
android:textColor="#2c2a29"
android:inputType="textEmailAddress"
android:imeOptions="flagNavigateNext">
</EditText>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/table_cell_seperator"/>
<EditText
android:id="#+id/password_edit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:hint="PASSWORD"
android:singleLine="true"
android:textColor="#2c2a29"
android:background="#drawable/table_cell_bottom"
android:paddingLeft="5dp"
android:imeOptions="actionDone"/>
</LinearLayout>
<TextView
android:id="#+id/forgot_password_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:textSize="16sp"
android:text="Glemt Password?"
android:textColor="#ffff"/>
<TextView
android:id="#+id/invalid_alert_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Husk at udfylde e-mail/mobilnummer og password"
android:visibility="invisible"
android:textSize="16sp"
android:textColor="#ff0000"/>
<Button
android:id="#+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:layout_gravity="center"
android:background="#drawable/login_xml"
android:textColor="#ffffff"/>
</LinearLayout>
set softinputmode to adjustpan|adjust-resize by adding following line to activity tag:
android:windowSoftInputMode="adjustResize|adjustPan"
Related
I've got a popup layout inflator with EditText fields. It is opened inside my activity when a button is pressed. I then ask for input information through the popup window. When I press any of the EditText fields the keyboard doesn't display. Does the popup View not support interaction?
Here is my xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#android:color/background_light">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_margin="1dp"
android:background="#android:color/darker_gray">
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Fill in the information." />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Field ID or Name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/fieldname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_below="#+id/textView1"
android:ems="10" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/enterWidth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Width of Implement - Feet or Meters"
android:layout_below="#+id/fieldname"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/width"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:layout_below="#+id/enterWidth"
android:inputType="numberDecimal" />
<TextView
android:id="#+id/units"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Units"
android:layout_below="#+id/width"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RadioGroup
android:id="#+id/radiogroup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/units"
android:orientation="vertical">
<RadioButton android:id="#+id/standard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Standard - feet, ac, mph"
android:onClick="onRadioButtonClicked"/>
<RadioButton android:id="#+id/metric"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Metric - m, ha, kph"
android:onClick="onRadioButtonClicked"/>
</RadioGroup>
<TextView
android:id="#+id/comments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Field Comments"
android:layout_below="#+id/radiogroup"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/commentlines"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/comments"
android:ems="10"
android:inputType="textMultiLine" />
</RelativeLayout>
<Button
android:id="#+id/startbutton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Begin Spraying" />
</LinearLayout>
</LinearLayout>
After digging I found this similar post:
EditText On A Popup Window
The key is to make the PopupWindow focusable.
This can be done by:
popupWindow.setFocusable(true);
I am trying to allign 3 EditText boxes across the screen horizontally in my activity so that the user is able to enter data.
Currently the code that I am implementing doesnt allow the 3 boxes to fit on the screen. Only 1 box and half of the other are visible
How can I adjust my current code so that all 3 Edittext boxes are visible to the user?
Note: The button and textView at the bottom of the layout are also currently not visible, eventhough they should be under the 3 horizontally alligned Edittext boxes.
Current XML Layout:
<?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:orientation="vertical" >
<TextView
android:id="#+id/tvSearchDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Enter Date to search..."
android:textSize="15dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<EditText
android:id="#+id/etEnterSpecificyear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="" >
</EditText>
<TextView
android:layout_width="3dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<EditText
android:id="#+id/etEnterSpecificMonth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="" >
</EditText>
<TextView
android:layout_width="3dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<EditText
android:id="#+id/etEnterSpecificDay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="" >
</EditText>
</LinearLayout>
<Button
android:id="#+id/btnSearchDate"
android:layout_width="85dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:text="Submit"
/>
<TextView
android:id="#+id/tvSearchResultsDate"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="30"
android:minLines="5"
android:scrollbars="vertical"
android:text=" Results..."
android:textSize="15dp" />
</LinearLayout>
For each of your edittext make this:
<EditText
android:id="#+id/etEnterSpecificyear"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:hint="" >
</EditText>
And delete the TextView's that are in between the EditText's
Your issue is that you are using android:ems="10" in EditText properties. This one makes the minimum width of the EditText to be exact ten "M" characters. If this is your requirement I would suggest to use android:orientation="vertical" in the parent LinearLayout. So your final layout will look like:
<?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:orientation="vertical">
<TextView
android:id="#+id/tvSearchDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" Enter Date to search..."
android:textSize="15dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/etEnterSpecificyear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="">
</EditText>
<EditText
android:id="#+id/etEnterSpecificMonth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="">
</EditText>
<EditText
android:id="#+id/etEnterSpecificDay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="">
</EditText>
</LinearLayout>
<Button
android:id="#+id/btnSearchDate"
android:layout_width="85dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:text="Submit"
/>
<TextView
android:id="#+id/tvSearchResultsDate"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="30"
android:minLines="5"
android:scrollbars="vertical"
android:text=" Results..."
android:textSize="15dp"/>
</LinearLayout>
I have an activity that allows me to enter content. It consists of edit text and button bar. Whenever I what to input something to the edit text, a keyboard pops up and the button bar is on top if it so I can't see what I'm typing if the content is long(it goes behind the button bar). How can i fix it ?
my code is:
<RelativeLayout
android:id="#+id/toplayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/notetop"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp" >
<TextView
android:id="#+id/title_text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/title"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="18sp" />
<EditText
android:id="#+id/etTitleJoke"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#+id/title_text1"
android:background="#android:color/transparent"
android:hint="#string/no_title"
android:imeOptions="actionNext"
android:singleLine="true"
android:textColor="#000000"
android:textSize="18sp" >
</EditText>
</RelativeLayout>
<view
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/etContentJoke"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/toplayout"
class="ie.myjokes.LineEditText"
android:background="#android:color/transparent"
android:capitalize="sentences"
android:scrollHorizontally="true"
android:fadingEdge="vertical"
android:gravity="top"
android:padding="5dp"
android:scrollbars="vertical"
android:textColor="#000000"
android:textSize="22sp" >
<requestFocus />
</view>
<LinearLayout
android:id="#+id/footer"
style="#android:style/ButtonBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<Button
android:id="#+id/btnSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onClickSave"
android:text="#string/btn_save"
android:textColor="#000000" />
<Button
android:id="#+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onClickCancel"
android:text="#string/btn_cancel"
android:textColor="#000000" />
</LinearLayout>
nevermind, I added this line into my activity and its gone now. Thank you
android:windowSoftInputMode="adjustPan"
I want when user type then instead of arrow key it should show the next button in keyboard.
So user not need to press the back to input next edittext.
Added the Layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="#D5D5D5"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/topLinearLayout"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:background="#drawable/bar" >
<ImageView
android:id="#+id/new_quote_imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="#drawable/new_quote_bar" />
<TextView
android:id="#+id/contactUs"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="#string/contact_us"
android:textColor="#android:color/white"
android:textSize="15sp" />
</FrameLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dip" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight=".7"
android:background="#EEEBE6"
android:orientation="vertical"
android:padding="15dip" >
<TextView
android:id="#+id/nameTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dip"
android:text="#string/name"
android:textColor="#android:color/black"
android:textSize="16sp" />
<EditText
android:id="#+id/nameEditText"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:layout_marginTop="10dip" />
<TextView
android:id="#+id/emailTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dip"
android:text="#string/email"
android:textColor="#android:color/black"
android:textSize="16sp" />
<EditText
android:id="#+id/emailEditText"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:layout_marginTop="10dip"
android:inputType="textEmailAddress" />
<TextView
android:id="#+id/commentsTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dip"
android:text="#string/comments"
android:textColor="#android:color/black"
android:textSize="16sp" />
<EditText
android:id="#+id/commentsEditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:lines="5" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_marginTop="5dip"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dip"
android:layout_marginTop="10dip"
android:gravity="right|center_vertical"
android:weightSum="1" >
<Button
android:id="#+id/submitButton"
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_weight=".3"
android:background="#drawable/button_background"
android:text="#string/submit"
android:textColor="#android:color/white"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
Please help me for this.
Thanks in advance.
add this line to your edittext xml
android:singleLine="true"
If you don't want multiple line simple add
android:singleLine="true"
else please use this given solution
<EditText
android:id="#+id/commentsEditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:imeOptions="actionNext"
android:lines="5" />
I have added
android:imeOptions="actionNext"
this line extra, use this in every EditText that you want have next button in soft key Board
Define inputType for each edit text.
<EditText
android:id="#+id/editText"
android:inputType="textPersonName" />
Try adding this to the edit text:
android:singleLine="true"
android:singleLine="true" //deprecated
use android:maxLines="1" & imeOptions
android:maxLines="1"
android:imeOptions="actionNext"
Simply use
android:inputType="textNoSuggestions"
android:maxLines="1"
and remove if you have used digits.
android:digits
Add below line in your edittext
android:imeOptions="flagNavigateNext"
Example given below:
<EditText
android:id="#+id/commentsEditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:lines="5"
android:imeOptions="flagNavigateNext"/>
Try adding this
android:imeOptions="flagNavigateNext"
android:inputType="text"
I am working in android. I am designing a login page.
This is my xml:-
<LinearLayout
android:layout_marginLeft="10dip"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_marginRight="10dip"
android:id="#+id/loginlayout"
android:orientation="vertical"
android:gravity="center_vertical|center_horizontal"
android:soundEffectsEnabled="false">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="#drawable/rounded_corners_white"
android:padding="20dp"
android:orientation="vertical">
<TextView
android:id="#+id/Text_UID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Id"
android:textColor="#000000"
android:textSize="8pt" />
</TextView>
<EditText
android:layout_height="wrap_content"
android:id="#+id/EditText_UID"
android:layout_width="200dp"
android:background="#drawable/text_box">
</EditText>
<TextView
android:id="#+id/Text_UID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="Password"
android:textSize="8pt">
</TextView>
<EditText
android:text=""
android:id="#+id/EditText_Pass"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:background="#drawable/text_box">
</EditText>
<RelativeLayout
android:layout_height="35px"
android:layout_width="fill_parent"
android:layout_marginTop="10dp">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:id="#+id/Button_Submit"
android:textColor="#FFFFFF"
android:clickable="true"
android:layout_toRightOf="#id/Button_Register"
android:background="#drawable/button_register_right"
android:layout_alignParentTop="true"
android:textSize="5pt">
</Button>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
whenever i enter user name then it is visible to user, but when i enter password then the entered text is not visible till the android device keyboard is active. When i press back button to remove android device keyboard then it is visible means password dot visible to user.
but when i run this project on system then both userid and password both are visible. please suggest me what should i do for this. is this matter of device dependent ?
Use this attribute in your Password EditText :
android:inputType="textPassword"
Try this layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginLeft="10dip"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_marginRight="10dip"
android:id="#+id/loginlayout"
android:orientation="vertical"
android:gravity="center_vertical|center_horizontal"
android:soundEffectsEnabled="false">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="#drawable/rounded_corners_white"
android:padding="20dp"
android:orientation="vertical">
<TextView
android:id="#+id/Text_UID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Id"
android:textColor="#000000"
android:textSize="8pt" />
<EditText
android:layout_height="wrap_content"
android:id="#+id/EditText_UID"
android:layout_width="200dp"
android:background="#drawable/text_box"/>
<TextView
android:id="#+id/Text_UID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="Password"
android:textSize="8pt"/>
<EditText
android:text=""
android:id="#+id/EditText_Pass"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:background="#drawable/text_box"
android:inputType="textPassword"/>
<RelativeLayout
android:layout_height="35px"
android:layout_width="fill_parent"
android:layout_marginTop="10dp">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:id="#+id/Button_Submit"
android:textColor="#FFFFFF"
android:clickable="true"
android:layout_toRightOf="#id/Button_Register"
android:background="#drawable/button_register_right"
android:layout_alignParentTop="true"
android:textSize="5pt">
</Button>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
you forget to set the input into the password field
Have you tried removing the weight attribute from your outermost LinearLayout, and have you tried wrapping the whole thing in a ScrollView?