本次內容是為解決EditText在默認情況下獲取到焦點,彈出輸入法框,影響用戶體驗而總結的簡便方法:
網上有如下的解決方案:
即在EditText前面放置一個看不到的LinearLayout,讓它率先獲取焦點: <LinearLayout android:focusable="true" android:focusableInTouchMode="true" android:layout_width="0px" android:layout_height="0px">
<EditText>
........
</LinearLayout>
我在使用的時候發現不是每次都管用,大家可以參考使用,然后下面是我使用有效的一種辦法:
讓EditText之前的控件先獲得焦點,即在EditText前面的一個控件上設置屬性:
android:focusable="true" android:focusableInTouchMode="true"
注意:一定要是之前的一個控件,之后的會沒有效果