第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

EditText 如何不讓其自動獲取焦點

標(biāo)簽:
Android

在项目中,一进入一个页面, EditText默认就会自动获取焦点。

那么如何取消这个默认行为呢?

在网上找了好久,有点 监听软键盘事件,有点 调用 clearFouse()方法,但是测试了都没有! xml中也找不到相应的属性可以关闭这个默认行为

解决之道:在EditText的父级控件中找一个,设置成

android:focusable="true"
android:focusableInTouchMode="true"

这样,就把EditText默认的行为截断了!
复制代码

1 <?xml version="1.0" encoding="utf-8"?>
2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 android:background="#CFD4DA"
6 android:orientation="vertical" >
7
8 <!-- 查询 增加 -->
9
10 <LinearLayout
11 android:layout_width="fill_parent"
12 android:layout_height="40dp"
13 android:background="#A1AEBF"
14 android:focusable="true"
15 android:focusableInTouchMode="true"
16 android:orientation="horizontal" >
17
18 <EditText
19 android:padding="2dp"
20 android:id="@+id/et_query"
21 android:layout_width="wrap_content"
22 android:layout_height="wrap_content"
23 android:layout_weight="4"
24 android:maxLength="13" />
25
26 <Button
27 android:id="@+id/bt_query"
28 android:layout_width="wrap_content"
29 android:layout_height="wrap_content"
30 android:layout_weight="0.5"
31 android:text="查询" />
32
33 <Button
34 android:id="@+id/bt_add"
35 android:layout_width="wrap_content"
36 android:layout_height="wrap_content"
37 android:layout_weight="0.5"
38 android:text="增加" />
39 </LinearLayout>
40
41 <ListView
42 android:id="@+id/lv_info_query_send"
43 android:layout_width="match_parent"
44 android:layout_height="match_parent"
45 android:layout_marginTop="20dp" />
46
47 </LinearLayout>

點擊查看更多內(nèi)容
3人點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優(yōu)質(zhì)文章

正在加載中
移動開發(fā)工程師
手記
粉絲
1
獲贊與收藏
19

關(guān)注作者,訂閱最新文章

閱讀免費教程

感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學(xué)

大額優(yōu)惠券免費領(lǐng)

立即參與 放棄機會
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號

舉報

0/150
提交
取消