我有一个editText,其背景设置为透明,使其看起来像一个textView。 如何在改变editText的背景之后将文本移回旧位置?
在Onfocuschanged方法,在重点我设置的背景资源为
ph.setBackgroundResource(android.R.drawable.edit_text);
当焦点被删除我想使它看起来像一个TextView了,所以我设置背景为
ph.setBackgroundColor(Color.TRANSPARENT);
但editText中的文本保留在前一个背景的位置,并且不会返回到其原始位置。
编辑: 为EDITTEXT
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:text="Medium Text"
android:id="@+id/ph"
android:layout_alignBottom="@+id/textView12"
android:layout_toRightOf="@+id/textView12"
android:layout_toEndOf="@+id/textView12" />
我该怎么做到这一点? – Isj