解決進入Activity默認焦點選中第一個EditText,並彈出軟鍵盤。

解決方法:在xml的根容器中添加兩個配置即可:將 focusable 和 focusableInTouchMode 都設爲 true 即可。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:focusable="true"
    android:focusableInTouchMode="true">

</LinearLayout>
 ———————————————— 
版權聲明:本文爲CSDN博主「violet-jack」的原創文章,遵循CC 4.0 by-sa版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/violetjack0808/article/details/78599738

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章