<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:hint="Password"
/>
This is the code I have in my xml file, the line android:inputType="textPassword" from my understanding is supposed to make the text entered in the field appear hidden. When run on and android device the text is not hidden.
Try this :
<EditText
android:layout_height="wrap_content"
android:gravity="center"
android:password="true"
android:layout_width="match_parent"
android:id="#+id/password"
android:hint="password"
android:maxLines="1">
</EditText>
Related
I have encountered a strange behaviour of android:imeOptions="actionNext". When I press next on the keyboard it actually navigates out of the AutoCompleteEditText but doesn't focus on the next one. I am using the same setting for my other EditTexts and it works fine.
Here is the .xml code:
<AutoCompleteTextView
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="#dimen/login_form_height"
android:hint="#string/prompt_email_username"
android:imeOptions="actionNext"
android:inputType="textEmailAddress"
android:maxLines="1"
android:padding="#dimen/login_form_padding" />
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="#dimen/login_form_height"
android:hint="#string/prompt_password"
android:imeActionId="6"
android:imeActionLabel="#string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:padding="#dimen/login_form_padding" />
So when I press next it leaves "#+id/email" but doesn't focus on "#+id/password".
Any ideas?
android:singleLine="true" or android:inputType="text" can solve your problem
<AutoCompleteTextView
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="#dimen/login_form_height"
android:hint="#string/prompt_email_username"
android:singleLine="true"
android:inputType="text"
android:imeOptions="actionNext"
android:maxLines="1"
android:padding="#dimen/login_form_padding" />
I am trying to implement AutoCompleteTextView with multiline text and with keyboard done button. But done button does not show on keyboard (shows enter button). Same thing i have tried with android:singleLine="true" and text comes in single line with done button.
<AutoCompleteTextView
android:id="#+id/txtVillageName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edt_border"
android:cursorVisible="true"
android:maxLines="4"
android:hint="Enter your location"
android:imeOptions="actionDone"
android:textColor="#color/text_color"
android:textColorHint="#color/lblColor"
android:textSize="#dimen/text_size_large" />
Add android:imeActionLabel="Done" into your xml code
<AutoCompleteTextView
android:id="#+id/txtVillageName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cursorVisible="true"
android:hint="Enter your location"
android:imeOptions="actionDone"
android:imeActionLabel="Done"
android:singleLine="true" />
android:inputType="text" works.
<AutoCompleteTextView
android:id="#+id/txtVillageName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:cursorVisible="true"
android:hint="#string/location_hint"
android:imeOptions="actionDone"
android:inputType="text"
android:textColor="#color/text_color"
android:textColorHint="#color/lblColor"
android:textSize="#dimen/text_size_large" />
Set HorizontalScrolling and MaxLines
mAutocompleteTextView.setHorizontallyScrolling(false);
mAutocompleteTextView.setMaxLines(Integer.MAX_VALUE);
It works
This is my xml code to make a input text for user phone number
but when it unfocused the hint label showed with larger text size
my question is how to make the hint label activated like password even when there is no text in the field.
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="#color/colorText">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/phone_number"
android:inputType="number"
android:maxLines="1"
android:textColorHint="#color/colorText" />
</android.support.design.widget.TextInputLayout>
Your hint is in the wrong place
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/phone_number"
android:textColorHint="#color/colorText">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:maxLines="1"
android:textColorHint="#color/colorText" />
</android.support.design.widget.TextInputLayout>
I designed a layout with four EditText and i want to facilitate the navigation of them. I understand the use of android:nextFocusDown but i'm not able to get it to work. I also setted the ´ImeOptions´ to actionNext, but on the softpad I neither see the right icon.
My XML snippet:
<EditText
android:id="#+id/reservation_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="#drawable/edit_text_reservation"
android:ems="10"
android:hint="#string/yourName"
android:imeOptions="actionNext"
android:nextFocusDown="#+id/reservation_surname" >
</EditText>
<EditText
android:id="#+id/reservation_surname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="#drawable/edit_text_reservation"
android:ems="10"
android:hint="#string/yourSurname"
android:imeOptions="actionNext"
android:nextFocusDown="#+id/reservation_email"
android:nextFocusUp="#+id/reservation_surname" />
<EditText
android:id="#+id/reservation_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="#drawable/edit_text_reservation"
android:ems="10"
android:hint="#string/yourEmail"
android:imeOptions="actionNext"
android:inputType="textEmailAddress"
android:nextFocusDown="#+id/reservation_notes"
android:nextFocusUp="#+id/reservation_email" />
<EditText
android:id="#+id/reservation_notes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edit_text_reservation"
android:ems="10"
android:imeOptions="actionDone"
android:inputType="textMultiLine"
android:nextFocusUp="#id/reservation_notes" />
I had a similar issue, where nextFocus* simply did not work. In your case..
going from
<EditText android:id="#+id/reservation_name"...
android:nextFocusDown="#+id/reservation_notes"
to
change surname's id to NOT have a "+" i.e.
<EditText android:id="#id/reservation_surname"
this way you are
no creating a new reference to that tag.
This will now work.
My scenario:
I have 2 EditText:
<EditText
android:id="#+id/edt1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
android:inputType="textPassword"
android:maxLength="8"
android:singleLine="true"
android:layout_below="#+id/add"/>
<EditText
android:id="#+id/edt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:digits="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
android:inputType="textPassword"
android:maxLength="8"
android:singleLine="true"
android:layout_below="#+id/edt1"/>
When edt1 is focused, I input number(keyboard shows number) then I next edt2, keyboard still displays number.
I want to keyboard change number to qwerty keyboard.
How can I do this?
UPDATED: I mean: qwerty keyboard always show when EditText is focused.
Thanks all!
Remove android:digits from both. In first EditText use android:inputType="number" and in second one use android:inputType="text"
Use this :
<EditText
android:id="#+id/edt1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:inputType="number"
android:maxLength="8"
android:singleLine="true"
android:layout_below="#+id/add"/>
<EditText
android:id="#+id/edt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:inputType="text"
android:maxLength="8"
android:singleLine="true"
android:layout_below="#+id/edt1"/>