久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 Android 上單擊軟鍵盤 Next 時移動到另一個 Edi

Move to another EditText when Soft Keyboard Next is clicked on Android(在 Android 上單擊軟鍵盤 Next 時移動到另一個 EditText)
本文介紹了在 Android 上單擊軟鍵盤 Next 時移動到另一個 EditText的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

當我按下下一步"時,用戶 EditText 上的焦點必須移至密碼.然后,從密碼,它必須向右移動,依此類推.你能幫我寫代碼嗎?

When I press the 'Next', the focus on the User EditText must be move to the Password. Then, from Password, it must move to the right and so on. Can you help me on how to code it?

<LinearLayout
    android:id="@+id/LinearLayout01"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/username"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="User Name*" />

    <EditText
        android:id="@+id/txt_User"
        android:layout_width="290dp"
        android:layout_height="33dp"
        android:singleLine="true" />

</LinearLayout>


<LinearLayout
    android:id="@+id/LinearLayout02"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/password"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Password*" />

    <EditText
        android:id="@+id/txt_Password"
        android:layout_width="290dp"
        android:layout_height="33dp"
        android:singleLine="true"
        android:password="true" />

    <TextView
        android:id="@+id/confirm"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Password*" />

    <EditText
        android:id="@+id/txt_Confirm"
        android:layout_width="290dp"
        android:layout_height="33dp"
        android:singleLine="true"
        android:password="true" />

</LinearLayout>

推薦答案

焦點處理

焦點移動基于找到最近的算法給定方向的鄰居.在極少數情況下,默認算法可能與開發人員的預期行為不匹配.

Focus Handling

Focus movement is based on an algorithm which finds the nearest neighbor in a given direction. In rare cases, the default algorithm may not match the intended behavior of the developer.

使用以下 XML 屬性更改定向導航的默認行為:

Change default behaviour of directional navigation by using following XML attributes:

android:nextFocusDown="@+id/.."  
android:nextFocusLeft="@+id/.."    
android:nextFocusRight="@+id/.."    
android:nextFocusUp="@+id/.."  

除了定向導航,您還可以使用標簽導航.為此,您需要使用

Besides directional navigation you can use tab navigation. For this you need to use

android:nextFocusForward="@+id/.."

要獲得特定視圖的焦點,請調用

To get a particular view to take focus, call

view.requestFocus()

要監聽某些變化的焦點事件,請使用 View.OnFocusChangeListener

To listen to certain changing focus events use a View.OnFocusChangeListener

您可以使用 android:imeOptions 用于處理鍵盤上的額外按鈕.

You can use android:imeOptions for handling that extra button on your keyboard.

您可以在與編輯器關聯的 IME 中啟用的其他功能改進與您的應用程序的集成.這里的常數對應于 imeOptions 定義的那些.

Additional features you can enable in an IME associated with an editor to improve the integration with your application. The constants here correspond to those defined by imeOptions.

imeOptions 的常量包括各種動作和標志,請參閱上面的鏈接了解它們的值.

The constants of imeOptions includes a variety of actions and flags, see the link above for their values.

值示例

ActionNext:

操作鍵執行下一步"操作,將用戶帶到下一個接受文本的字段.

the action key performs a "next" operation, taking the user to the next field that will accept text.

ActionDone:

操作鍵執行完成"操作,通常意味著無需輸入任何內容,IME 將關閉.

the action key performs a "done" operation, typically meaning there is nothing more to input and the IME will be closed.

代碼示例:

<RelativeLayout 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"
    tools:context=".MainActivity" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="32dp"
        android:layout_marginTop="16dp"
        android:imeOptions="actionNext"
        android:maxLines="1"
        android:ems="10" >

        <requestFocus />
    </EditText>

    <EditText
        android:id="@+id/editText2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/editText1"
        android:layout_below="@+id/editText1"
        android:layout_marginTop="24dp"
        android:imeOptions="actionDone"
        android:maxLines="1"
        android:ems="10" />

</RelativeLayout>

如果您想收聽 imeoptions 事件,請使用 TextView.OnEditorActionListener.

If you want to listen to imeoptions events use a TextView.OnEditorActionListener.

editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == EditorInfo.IME_ACTION_SEARCH) {
            performSearch();
            return true;
        }
        return false;
    }
});

這篇關于在 Android 上單擊軟鍵盤 Next 時移動到另一個 EditText的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event(EditText:禁用文本選擇處理程序單擊事件上的粘貼/替換菜單彈出)
Multiline EditText with Done SoftInput Action Label on 2.3(2.3 上帶有完成 SoftInput 操作標簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測向左或向右滑動?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉對話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設置為僅接受 Android 中的數值?)
主站蜘蛛池模板: 色婷婷一区二区三区四区 | 中文字幕一区二区三 | 国产精品一区网站 | 亚洲在线免费观看 | 国产综合精品一区二区三区 | 欧美精品一区二区三区四区 在线 | 亚洲成人综合社区 | 黄色一级大片视频 | 欧美最猛黑人xxxⅹ 粉嫩一区二区三区四区公司1 | 欧美日韩在线观看一区 | 精品久久久久久久 | 国产精品久久久久久av公交车 | 国产免费一区二区三区 | 99综合 | 日韩av在线一区 | 欧美日韩高清一区二区三区 | 欧美在线视频一区二区 | 91精品国产91久久久久游泳池 | 亚洲国产精品久久久久秋霞不卡 | 成人影视网 | 精品日韩一区二区 | 天天躁日日躁xxxxaaaa | 国产999精品久久久影片官网 | 欧美激情亚洲 | 婷婷综合| 成人免费视频网站在线看 | 福利在线看 | 欧美日韩综合一区 | 日韩免费网站 | 一区二区免费在线观看 | 人人爽日日躁夜夜躁尤物 | 久久国产一区 | 色橹橹欧美在线观看视频高清 | 亚洲狠狠丁香婷婷综合久久久 | 欧美日韩在线观看一区二区三区 | 成人在线亚洲 | 国产精品爱久久久久久久 | 精品久久精品 | 久久综合狠狠综合久久综合88 | 成人免费淫片aa视频免费 | 一级日韩 |