How to make the floating label under the text in TextInputLayout? - android

The TextInputLayout widget support floating label for EditText(check this post here), but default the floating label is above the text.
But I want to make the label under the text like this, how to do it???

Refer Android Floating Label EditText
http://www.truiton.com/2015/06/android-floating-label-edittext/

Related

How to change the focused hint color(upper) of TextInputLayout according to specific conditions programmatically

If the text entered in TextInputLayout meets the email regular expression, I would like to change the color of the hint label shown in the attached picture as programmatically.
You can use setHintTextColor function of the TextInputLayout to programatically change the hint color according to your preference.
TextInputLayout textInputLayout = findViewById(R.id.textInputLayout);
int colorInt = getResources().getColor(R.color.red,getTheme());
ColorStateList colorStateList = ColorStateList.valueOf(colorInt);
textInputLayout.setHintTextColor(colorStateList);
This will change the hint label color like this :

How to give extra left padding to floating label in TextInputLayout android

My requirement is that I need to display the floating label on an Outlined TextInput Box a little to the right of the underlying EditText text value
Something like this-
See how the label Notes is a little to the right of Enter/View Notes. I tried to use hintTextAppearance attribute in the styles with paddingStart but the padding is just ignored.
Is there a way to customize the label's margin/padding to set the label a little towards right?

How to change hint text color of edittext when TextInputLayout is used

I have a screen with edittexts. When these edittexts are disabled, I need the hint color to be in one color
When these are enabled, I need the hint to be in a different color like this
This works fine when I tried like this
editText.setHintTextColor(color);
The problem is , I have to use a TextInputlayout to show the floating hint. So, When I add the EditText inside TextInputLayout this code doesn't work at all. I tried many things with TextInputLayout as shown here. But nothing works. All I need is the hint text color (Not floating hint text) of the EditText should be in one color when enabled , and in different color when disabled, when used inside a TextInputLayout. Please help!
Note: My question is not a duplicate of this question. There , it is mentioned about the floating hint text of the TextInputLayout when it is focused What I am talking about the normal hint text when the edit text is not focused and also when it is empty.
Add these to your App theme
<item name="colorControlNormal">#color/color</item>
<item name="colorControlActivated">#color/color</item>
<item name="colorControlHighlight">#color/color</item>
<item name="android:textColorHighlight">#color/color</item>

About text Filter and textWatcher in Android

enter image description here
I made an android app by using Textwatcher and Filter.
Whenever I search some text, this screen made me interrupted.. T_T
Why this box which is included in text is shown up?
Please help me T_T
Actually it gives suggestion when you type.
To remove suggestion box add this property to EditText in xml layout
android:inputType="text|textNoSuggestions"
To remove mic icon from box add below property to EditText in xml layout
android:privateImeOptions="nm" // "nm" : No Mic

Underline text inside Editbox

As I enter text in editText it should automatically underline the text I entered. I need like as I continue to enter text in editText it draw like in background.
Can someone help me.
Use view with 1 dp of height and custom width with green background , inside framelayout over your editText, and handle custom_width same as you are handling image_width.
For underline effect in EditText you need to add this
//initialize edittext before
editText.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);

Categories

Resources