textinputlayout

Keep Textinputlayout hint always top

ε祈祈猫儿з 提交于 2021-02-08 12:19:44
问题 Would be possible have my hint text always top, as if it were focusable? I tried this: <android.support.design.widget.TextInputLayout android:id="@+id/etSurnameInput" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/llNameImage" android:hint="My Hint Text" app:hintEnabled="true" app:hintAnimationEnabled="false" android:textColorHint="@color/gray_title"> 回答1: Here's a hack - programmatically add a space in the text if it's empty. However, you

How to get Textinputlayout hint android in multiple lines?

让人想犯罪 __ 提交于 2020-03-18 11:16:23
问题 I have tried many options available online but none of them seem to be working. I have used this XML for this purpose. <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" app:hintTextAppearance="@style/TextLabel"> <com.projects.fonts.RobotoEditText style="@style/EditText" android:hint="@string/description" android:singleLine="false" app:font="@string/roboto_regular" /> </android.support.design.widget.TextInputLayout> I have

TextInputLayout Error right align

被刻印的时光 ゝ 提交于 2019-12-30 05:59:10
问题 I've an EditText enclosed within a TextInputLayout. I wish to display errors under the EditText, but aligned to the right end of the screen. This is what I currently have: The error is displayed like this: What I want it to look like: My XML is this: <android.support.design.widget.TextInputLayout android:id="@+id/text_input_email" style="@style/forgot_pass_text_inputlayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/tv_enter_email

set error TextInputLayout in Fragment

旧时模样 提交于 2019-12-24 13:49:07
问题 I have an issue with TextInputLayout when I set the error message. I'm using the following package 'com.android.support:design:23.1.1' in a Fragment. This is the code if (tvName.getText().toString().trim().isEmpty()) { textInputLayoutName.setErrorEnabled(true); textInputLayoutName.setError("erreur"); } the XML part <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/TextLabel" android:id="@+id/input

How to create TextInputLayout with OutlineBox programmatically

戏子无情 提交于 2019-12-21 07:46:09
问题 I want to create TextInputLayout with Widget.MaterialComponents.TextInputLayout.OutlinedBox style. I tried many ways but couldn't get the required result. Here is my code. TextInputLayout textInputLayout = new TextInputLayout(getActivity(),null,R.style.Widget_MaterialComponents_TextInputLayout_OutlinedBox); textInputLayout.setHint("My Hint"); TextInputEditText editText = new TextInputEditText(textInputLayout.getContext()); textInputLayout.addView(editText); parentView.addView(textInputLayout)

How to create TextInputLayout with OutlineBox programmatically

夙愿已清 提交于 2019-12-21 07:45:56
问题 I want to create TextInputLayout with Widget.MaterialComponents.TextInputLayout.OutlinedBox style. I tried many ways but couldn't get the required result. Here is my code. TextInputLayout textInputLayout = new TextInputLayout(getActivity(),null,R.style.Widget_MaterialComponents_TextInputLayout_OutlinedBox); textInputLayout.setHint("My Hint"); TextInputEditText editText = new TextInputEditText(textInputLayout.getContext()); textInputLayout.addView(editText); parentView.addView(textInputLayout)

Android password visibility toggle not working with support library 25?

旧城冷巷雨未停 提交于 2019-12-21 03:58:08
问题 I have implemented a TextInputLayout with a password field in the usual way: <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/returning_password" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/prompt_password" android:inputType="textPassword" android:maxLines="1" android:textSize="14sp" /> </android.support.design.widget.TextInputLayout> This

AppCompatEditText.getpParent() inside TextInputLayout returns FrameLayout

半世苍凉 提交于 2019-12-18 03:22:25
问题 I am creating simple AppCompatEditText adding OnFocusChangeListener and putting it in the simple TextInputLayout. When AppCompatEditText loosing focus it's content should be validate by isValidParam method. It worked till yesterday, when I used rev.23.0.3 But now, when I used rev.24.0.2, it gives error as below on the 1st row of isValidParam method. java.lang.ClassCastException: android.widget.FrameLayout cannot be cast to android.support.design.widget.TextInputLayout I checked in debugging

Multicolored edittext hint

浪子不回头ぞ 提交于 2019-12-12 12:07:50
问题 Is there a way to set multiple colors to the edittext's hint when wrapped by android.support.design.widget.TextInputLayout without compromising the behaviour of floating edittexts? like, Headline* Headline and * with different colored hint 回答1: Use SpannableString class which allows you to use different styles on parts of your string ... If I remember correctly, TextAppearanceSpan class is used for coloring a text.. 回答2: See below code this is work for me. EditText editText = (EditText)

Android TextInputLayout hint overlaps EditText hint

梦想与她 提交于 2019-12-12 10:43:44
问题 I am facing a weird issue, I have a InputTextLayout and an EditText in it, and I am trying to achieve something like this (shown in image below) (Image from material design guidlines: https://material.io/guidelines/components/text-fields.html#text-fields-layout), where there are two separate hints. I am doing this by adding android:hint to both layouts. This works fine, but when the focus moves away from this, the "label" moves down and overlaps the "placeholder" text. (Only when the user has