本文介紹了禁用對(duì)編輯文本的自動(dòng)對(duì)焦的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
限時(shí)送ChatGPT賬號(hào)..
我有一個(gè)編輯文本:
<LinearLayout android:id="@+id/linearLayout7" android:layout_width="match_parent" android:layout_height="wrap_content">
<EditText android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1" android:id="@+id/editText1" android:text="3">
<requestFocus></requestFocus>
</EditText>
<Button android:text="Button" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button2"></Button>
</LinearLayout>
然后是下面的一些其他東西
and then some other stuff underneath
我遇到的問題是,當(dāng)應(yīng)用程序啟動(dòng)時(shí),焦點(diǎn)在輸入上,我不希望在應(yīng)用程序啟動(dòng)時(shí)焦點(diǎn)在輸入上.
The problem I'm having is that right when the app starts the focus is on the input, i dont want focus to be on input right when the app starts.
我嘗試刪除
<requestFocus></requestFocus>
事情,它什么也沒做.
推薦答案
添加 android:focusable="true"
和 android:focusableInTouchMode="true"
元素" rel="noreferrer">EditText 如下;
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout7" android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true" android:focusableInTouchMode="true">
我想,它應(yīng)該對(duì)你有幫助.
I think, it should help you.
另見;
Android 開發(fā)者關(guān)于處理觸摸和輸入的官方指南
這篇關(guān)于禁用對(duì)編輯文本的自動(dòng)對(duì)焦的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!