在Android布局文件中,當有EditText時,該控件會自動獲取焦點,在頁面打開時,EditText中會出現光標,如何修改EditText默認獲取焦點的方法如下:
在EditText所在的父類容器中,設置兩個屬性為true即可
android:focusable="true" android:focusableInTouchMode="true栗子:
<LinearLayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" android:focusable="true" android:focusableInTouchMode="true> <EditText android:layout_height="match_parent" android:layout_width="match_parent"/></LinearLayout>新聞熱點
疑難解答