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>
Related
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"/>
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:
Android soft keyboard covers EditText field
(15 answers)
Closed 7 years ago.
I define EditText on the button of my application
Its look like this:
But when i focus on the EditText of the Notes the keyboard is open and cover all my EditText and i can't see what i typing in the EditText.
When i hide the keyboard i see the right text that i typed in.
The xml of the LinearLayout of the EditText:
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Notes:"
android:id="#+id/textView"
android:textColor="#000000" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editText"
android:focusable="true" />
</LinearLayout>
You might need to use windowSoftInputMode attribute in your activity in the manifest. Somelike this:
<activity name="YourActivity"
android:windowSoftInputMode="adjustPan">
...
</activity>
Check those links:
Android soft keyboard covers edittext field
http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html
The only solution to this is to put your text box in a different place.
Think about it... Do you really want your text box ABOVE your keyboard?
This is a fairly common issue, and it something that should always be taken into account when designing your layout.
so this solve my problem ( thanks to #Coeus )
I define on the manifest this line
android:windowSoftInputMode="adjustPan"
This question already has answers here:
android prevent EditText from requesting focus automatically [duplicate]
(3 answers)
Closed 7 years ago.
I have a layout with a single TextInputLayout with an EditText inside it.
When the layout is loaded the EditText is immediately in edit mode, the keyboard is not up but the cursor is blinking and the hint is not inside the EditText but above it.
I want the hint to be animated out of the EditText only the the use first clicks the EditText.
How can I accomplish that? I have tried clearFocus() on both the EditText and the TextInputLayout.
My xml:
<android.support.design.widget.TextInputLayout
android:id="#+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<EditText
android:singleLine="true"
android:id="#+id/case_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Case name" >
</EditText>
</android.support.design.widget.TextInputLayout>
try this
editText.setCursorVisible(false)