Android EditText宽度,因为提示

我有一个EditText.
我有少于8个字符时,EditText具有最小宽度.
我想使用wrap_content.

这是因为暗示造成的.

我怎么解决这个问题?
我尝试了一切.

我想这样:

这是我的代码

<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"

        />

解决方法

唯一的方法删除提示或减少提示字符串的长度.
如果您不想删除提示,请在将文本输入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 arg3) {
                // Todo Auto-generated method stub

            }

            @Override
            public void afterTextChanged(Editable arg0) {
                // Todo Auto-generated method stub

            }
        });

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...