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

在 Android 上單擊軟鍵盤 Next 時(shí)移動(dòng)到另一個(gè) Edi

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

問題描述

當(dāng)我按下下一步"時(shí),用戶 EditText 上的焦點(diǎn)必須移至密碼.然后,從密碼,它必須向右移動(dòng),依此類推.你能幫我寫代碼嗎?

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>

推薦答案

焦點(diǎn)處理

焦點(diǎn)移動(dòng)基于找到最近的算法給定方向的鄰居.在極少數(shù)情況下,默認(rèn)算法可能與開發(fā)人員的預(yù)期行為不匹配.

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 屬性更改定向?qū)Ш降哪J(rèn)行為:

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

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

除了定向?qū)Ш?,您還可以使用標(biāo)簽導(dǎo)航.為此,您需要使用

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

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

要獲得特定視圖的焦點(diǎn),請(qǐng)調(diào)用

To get a particular view to take focus, call

view.requestFocus()

要監(jiān)聽某些變化的焦點(diǎn)事件,請(qǐng)使用 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.

您可以在與編輯器關(guān)聯(lián)的 IME 中啟用的其他功能改進(jìn)與您的應(yīng)用程序的集成.這里的常數(shù)對(duì)應(yīng)于 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 的常量包括各種動(dòng)作和標(biāo)志,請(qǐng)參閱上面的鏈接了解它們的值.

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

值示例

ActionNext:

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

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

ActionDone:

操作鍵執(zhí)行完成"操作,通常意味著無(wú)需輸入任何內(nèi)容,IME 將關(guān)閉.

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 事件,請(qǐng)使用 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;
    }
});

這篇關(guān)于在 Android 上單擊軟鍵盤 Next 時(shí)移動(dòng)到另一個(gè) EditText的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

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 操作標(biāo)簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測(cè)向左或向右滑動(dòng)?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉(zhuǎn)對(duì)話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點(diǎn)擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設(shè)置為僅接受 Android 中的數(shù)值?)
主站蜘蛛池模板: 日本精品视频 | 久久久久久免费免费 | 国产激情一区二区三区 | 91精品国产91久久久久福利 | 中文欧美日韩 | 国产 日韩 欧美 制服 另类 | 狠狠干天天干 | 影音先锋久久 | 久久久久久国产免费视网址 | 麻豆一区 | 日韩成人在线播放 | 国产精品久久久久久久久免费相片 | 国产99久久精品一区二区永久免费 | 国产精品日本一区二区在线播放 | 欧美视频二区 | 久久伊| 亚洲一区二区三区在线视频 | 免费毛片网 | 美女在线一区二区 | 欧美a在线看 | 日本中文字幕一区 | 黑人粗黑大躁护士 | 日韩一区二 | 亚洲综合色网站 | 成人精品福利 | av免费网站在线观看 | 亚洲性人人天天夜夜摸 | 成人毛片在线观看 | 自拍偷拍亚洲欧美 | 国产成人一区二区三区久久久 | 成人免费视频在线观看 | a久久久久久 | 中文在线播放 | 欧美一区二区三区,视频 | 精品国产aⅴ | 日本精品一区二区三区在线观看视频 | 国产成人免费在线 | 久久国产综合 | 日韩一级黄色片 | av网站免费观看 | 中文字幕人成乱码在线观看 |