This question already has answers here:
Android RTL password fields?
(6 answers)
Closed 6 years ago.
I'm facing an issue that when I define an EditText as password type and view my screen in Arabic language the password field hint text is showing on the left side instead of right side [that is expected].
Above is the result I get. I need password hint text to be starting from the right side that's where Arabic writings start. I've also tried adding text gravity to it but no luck.
Please refer to this post :
Android RTL password fields?
For API 17+ you can use
android:textAlignment="viewStart"
Try this:
<EditText
android:id="#+id/input_password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="كلمة المرور"
android:textColorHint="#FFFFFF"
android:gravity="right"
android:inputType="textPassword"
android:background="#null"
android:textColor="#FFFFFF"
android:textSize="20dp"/>
Related
This question already has answers here:
Android EditText with different floating label and placeholder
(8 answers)
Closed 2 years ago.
var tel_text = "Enter your phone number"
Consider that the edittext is tel_text with a large font. When the user starts writing this article in edittext, I want it to be animated from bottom to top. How can I customize Edittext the easiest?
It looks like you want to add a hint to it which animates to the top when user begins to type. Wrap it inside TextInputLayout
<android.support.design.widget.TextInputLayout
android:id="#+id/edt_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter your phone number">
<EditText
android:id="#+id/edit"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
This question already has answers here:
Unable to use drawable in EditText inside TextInputLayout
(5 answers)
Closed 6 years ago.
I am using code bellow to display User name Input. EditText is working properly but Right side display icon is not visible.
<android.support.design.widget.TextInputLayout
android:id="#+id/login_screen_edit_text_username_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/login_screen_edit_text_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/label_username"
android:inputType="text"
android:drawableRight="#mipmap/email_icon"
android:text="abcd#gmail.com"
/>
</android.support.design.widget.TextInputLayout>
I am testing this code on Nexus6p android version 6.0. Parent layout is LinearLayout.Please update if anybody facing same issue and got fix for it.
use
android:drawableEnd="#mipmap/email_icon"
instead of
android:drawableRight="#mipmap/email_icon"
This question already has answers here:
Adding a drawableLeft to an EditText shifts the hint towards right, if edittext is inside TextInputlayout
(3 answers)
Closed 6 years ago.
I have added a drawableLeft in and EditText enclosed in TextInputLayout. The position of hint of TextInputLayout is according to the text position(From left i.e. next to drawableLeft) as:
But I want the position of hint as below.
Thank you.
There's no way to currently do this. If you check out the TextInputLayout source, you can see that the hint takes the parent's compound padding into account. The CollapsingTextHelper is not part of the layout's public API, so you can't change its behavior easily.
Your best bet is to change your requirement for this padding or use some sort of custom layout to reach a compromise between effort and effect.
Try below code
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:layout_height="54dp"
android:gravity="bottom"
android:paddingTop="4dp"
android:clipToPadding="false" // above 3 lines are important
android:id="#+id/emailWrapper"
app:hintTextAppearance="#style/floatingLabel">
<EditText
android:layout_width="match_parent"
android:layout_height="54dp"
android:paddingLeft="17dp"
android:paddingRight="17dp"
android:id="#+id/txtEmail"
android:singleLine="true"
android:inputType="textEmailAddress"
android:hint="#string/emailPlaceholder"
android:text="a#a.com"
android:background="#drawable/btn_empty_stroke" />
</android.support.design.widget.TextInputLayout>
Check it also : Android: How to change the textsize in an EditText field?
This question already has answers here:
TextView to display hint before text entered
(2 answers)
Closed 8 years ago.
In my android app I have a text field that says "how much would you like to take".
I want the text to be erased automatically and replaced by what the user inputs when they type in that textfield.
Example: if the user enters one character it automatically deletes "how much would you like to take" from the text field and replaces it with the one character that's been entered.
In your xml file use
android:hint="how much would you like to take"
in your TextView definition
(Well, it should be something like "#string/how_much" and that how_much string in strings.xml, but honestly...)
Its called android:hint property of a EditText you can set it into your xml file.
Something like that.
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="how much would you like to take" />
Try this in your xml
Use this in below code android:hint="how much would you like to take"
<EditText
android:id="#+id/edtName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txtName"
android:layout_marginRight="5dip"
android:hint="how much would you like to take"
android:inputType="textCapSentences"
/>
Hope it helps
This question already has answers here:
Can we have uneditable text in edittext
(2 answers)
Closed 10 years ago.
I have an edit text. How can I make it non editable from the code.
By giving the tag android:editable we can do in the layout.. But I need to do it in the code...Pls Help
I believe it is as simple as
editText.setEnabled(false);
Refer EDITTEXT
edt.setClickable(false);
edt.setFocusable(false);
***Layout***
<EditText android:id="#+id/edt"
android:layout_width="200px" android:layout_height="wrap_content"
android:text="" android:textSize="18sp" android:maxLength="15">
</EditText>
If you didnt find yet an answer, i have found this in the net:
http://code.google.com/p/android/issues/detail?id=2854
I am using for this problem, this solution:
valueText.setEnabled(false);
valueText.setClickable(false);
valueText.setFocusable(false);
//Just for better text vision
valueText.setTextColor(Color.WHITE);