TextInputLayout not showing hint text fully - android

I'm using recently released Android Design Support Library to show floating label with EditTexts. But I'm facing the problem that the Hint text is max hint text does not show fully it show ..... on rest of words.
My Layout is as follows:
<android.support.design.widget.TextInputLayout
android:id="#+id/input_layout_question"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:textColorHint="#android:color/black"
app:hintTextAppearance="#style/TextAppearence.App.TextInputLayout">
<EditText
android:id="#+id/et_test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:imeOptions="actionNext"
android:inputType="text"
android:lines="1"
android:textColor="#android:color/black"
android:textColorHint="#android:color/black"
android:textSize="#dimen/et_font_size"
android:theme="#style/MYAppTheme"/>
</android.support.design.widget.TextInputLayout>
Currently showing like this.

I'm using recently released Android Design Support Library to show floating label with EditTexts. But I'm facing the problem that the Hint text is max hint text does not show fully it show
AFAIK it is not possible to add MultiLine hint in TextInputLayout

Related

endIconTint in TextInputLayout is not working

I'm creating a login form with TextInputLayout and TextInputEditText but toggle password icon always show in white no matter which color I assign to it as endIconTint. I have tested this on
Android 6
Android 10
both show the same results.
Here is my Form when I use Widget.MaterialComponents.TextInputLayout.OutlinedBox as a style in TextInputLayout. It seems like its not showing drawable but that's not the case its not visible as drawable & input field background color is white. When I click on the end it toggle password.
Here is the form when I use Widget.MaterialComponents.TextInputLayout.FilledBox
And here is my code you can see I'm currently assigning black color to the endIconTint
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/password_til"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/activity_vertical_margin"
android:hint="Password"
app:counterEnabled="true"
app:counterMaxLength="20"
app:endIconMode="password_toggle"
app:endIconTint="#color/black"
app:helperText="required*"
app:helperTextTextColor="#android:color/holo_red_dark"
app:layout_constraintTop_toBottomOf="#id/username_til"
app:passwordToggleEnabled="true"
app:startIconDrawable="#drawable/ic_key">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/password_tiet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:maxLength="20" />
</com.google.android.material.textfield.TextInputLayout>
I cross verified color from the color.xml file and tried other colors too but icon always appear as white. Please let me know what is wrong here or is it a bug?
Thanks & Regards
You have already specify app:endIconMode="password_toggle" so you don't require to set passwordToggleEnabled anymore.
Remove this from TextInputLayout and it resolve your issue.
app:passwordToggleEnabled="true"

Android textedit box characters display unreadable

When adding a textedit to a dialog box in an xml file, for some reason, my textedit box displays bars (i.e unreadable text) when I enter text either from a real device or simulator (see screen shot.)
Text displays fine if I do this programmatically. Anybody had this problem? And was able to resolve it?
In conclusion, I changed the Layout Weight. Here is the xml for the EditText:
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="2"
android:id="#+id/edittext_box"
android:layout_weight="1"
android:textSize="14sp"
android:paddingLeft="5dp"
android:textColor="?android:attr/colorControlHighlight"
android:inputType="number"
android:maxLength="4"
android:minWidth="40dp" />

How to create textarea and edittext with border and fixed label?

I am new to Android. I am wondering how can we get a bordered Edittext and Textarea like we have in HTML something like this:
I am finding it hard to get such output in Lollipop devices as it shows as a line and a floating label.
In situation like this according to Google docs you would prefer TextInputLayout
For example:
<android.support.design.widget.TextInputLayout
android:id="#+id/password_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content>
<EditText
android:id="#+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/password_hint"
android:textColor="#777777"
android:textColorHint="#777777"
android:textSize="#dimen/text_20"
android:imeActionId="#+id/input_password"
android:imeOptions="actionNext"
android:inputType="textPassword"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>

Make Label(Floating Label) of TextInputLayout either Marquee or show in multiple lines

I want to make label of TextInputLayout either Marquee or in Multiple lines.
I tried android:ellipsize property with TextInputLayout and with AppCompatEditText but not able to get desired result.
Please guide me how I can set Floating label of TextInputLayout either marquee or in multiple lines.
My code is as follows:
<android.support.design.widget.TextInputLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:hintTextAppearance="#style/TextAppearence.App.TextInputLayout">
<android.support.v7.widget.AppCompatEditText
style="#style/style_name"
android:layout_width="fill_parent"
android:hint="Demo Long Hint Text Text text Text Text Text"
android:imeOptions="actionNext"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
I also tried to apply android:ellipsize="marquee" direct to EditText, but it causes crash my application.

TextInputLayout hint padding not working

I want to give padding to hint of edittext in TextInputLayout
where email address is hint and Sample is text
also tried this solution but didn't work.
facing this issue after changing support design library 23.1.0
here is my code
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp">
<android.support.v7.widget.AppCompatEditText
android:id="#+id/edtEmailAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/border_round_edt_grey"
android:focusableInTouchMode="true"
android:hint="#string/emailadd"
android:padding="10dp"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
As per this answer ,if you have custom background set on EditText the android:padding attribute simple doesn't work to alter the spacing b/w the hint text and edit text .So if you have set custom background to your AppCompatEditText, you can use android:translationY attribute in the AppCompatEditText
Please add below line in your AppCompatEditText.
android:translationY="10dp"
hope you got your answer :)

Categories

Resources