Android EditText Width because tooltip

I have an EditText . When I have less than 8 characters, EditText has a minimum width. I want to use wrap_content .

This is because hint .

How can i solve this? I have tried everything.

I want like this:

enter image description here

Here is my code

 <EditText android:id="@+id/et_actionbar_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="YOLO" android:hint="New team" android:gravity="center" android:textColor="@color/gray1" android:textStyle="bold" android:background="@color/gold" android:layout_centerInParent="true" android:minWidth="0dp" android:minEms="0" android:minHeight="0dp" android:paddingLeft="0dp" android:layout_marginLeft="0dp" /> 
+7
android text android-edittext
source share
2 answers

The only way to do this is to remove the tooltip or reduce the length of the tooltip. If you do not want to delete the tooltip, hide it when the text is entered into the EditText.

 editText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { if(!TextUtils.isEmpty(editText.getText().toString())){ editText.setHint(""); }else{ edittext.setHint(R.string.hint); } } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub } @Override public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub } }); 
+17
source share

I think it’s impossible to change the font of the tooltip, as the font is the same for the tooltip and text

but the work around will be

First set the text size

  android:textSize="20sp" 

second

when listening to text changes, the file size changes in accordance with the size of 10 s. then u could use the contents of the covers ...

0
source share

All Articles