![](/img/trans.png)
[英]How do I print text from EditText to a textview when pressed enter or a button
[英]How to have an 'EditText' element deselect itself when 'enter' is pressed
我正在制作一個android應用程序,我有一個EditText元素,在該字段中,一旦您按Enter鍵,同一頁面上其他位置的文本就會更新,盡管您無法立即看到它,因為鍵盤在路上。 簡而言之,有沒有辦法使鍵盤消失(即,在按下Enter鍵時使文本編輯器取消選擇自身)?
您只需要將EditText
設置為singleLine並啟用IMEAction
Done,如下所示:
<EditText
android:id="@+id/myEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:singleLine="true"
android:imeActionLabel="Done"
android:imeOptions="actionDone"
android:textColor="@android:color/black"
android:textSize="16sp" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.