Android开发 软键盘的右下角变为搜索按钮
生活随笔
收集整理的這篇文章主要介紹了
Android开发 软键盘的右下角变为搜索按钮
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
第一步 xml文件中添加Edittext控件
<EditTextandroid:id="@+id/et_key_word"android:layout_width="@dimen/qb_px_984"android:layout_height="@dimen/qb_px_106"android:layout_centerHorizontal="true"android:layout_marginTop="@dimen/qb_px_32"android:layout_marginBottom="@dimen/qb_px_32"android:background="@drawable/shape_activity_search"android:gravity="center"android:hint="搜索"android:imeOptions="actionSearch"android:singleLine="true"android:textColor="@color/color_text_666666"android:textColorHint="#ADB2B7"android:textSize="@dimen/qb_px_42"></EditText>關鍵字為 android:imeOptions=“actionSearch”
第二步 為Edittext控件添加鍵盤的搜索按鈕點擊監聽
et_key_word.setOnEditorActionListener(OnEditorActionListener { v, actionId, event ->if (actionId == EditorInfo.IME_ACTION_SEARCH) {nextDo()return@OnEditorActionListener true}false})完成
總結
以上是生活随笔為你收集整理的Android开发 软键盘的右下角变为搜索按钮的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [vuex] unknown mutat
- 下一篇: Block,多态,数组排序