第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

調(diào)用 performClick() 函數(shù)時(shí)一無(wú)所獲 - Android

調(diào)用 performClick() 函數(shù)時(shí)一無(wú)所獲 - Android

搖曳的薔薇 2022-07-06 10:46:36
我是 Android 開(kāi)發(fā)新手,現(xiàn)在我正在嘗試模擬單擊我的AutoCompleteTextView對(duì)象。我期待默認(rèn)的 android 鍵盤外觀,可以在元素上輸入一些東西這是一個(gè)簡(jiǎn)單的功能,我正在嘗試執(zhí)行它:private void someTestMethodName() {    AutoCompleteTextView tagSearchInput = findViewById(R.id.autoCompleteTextView);    tagSearchInput.performClick();}這是 .xml 元素定義:<AutoCompleteTextView        android:id="@+id/autoCompleteTextView"        android:text="TextView"        android:layout_width="188dp"        android:layout_height="62dp"        android:layout_alignParentStart="true"        android:layout_marginStart="108dp"        android:layout_alignParentTop="true"        android:layout_marginTop="292dp"/>
查看完整描述

2 回答

?
HUWWW

TA貢獻(xiàn)1874條經(jīng)驗(yàn) 獲得超12個(gè)贊

調(diào)用performClickaTextView不會(huì)彈出軟鍵盤,但您可以自己輕松完成:


private void someTestMethodName() {

    AutoCompleteTextView tagSearchInput = findViewById(R.id.autoCompleteTextView);

    showSoftKeyboard(tagSearchInput);

}


public void showSoftKeyboard(View view){

    if(view.requestFocus()){

        InputMethodManager imm =(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

        imm.showSoftInput(view,InputMethodManager.SHOW_IMPLICIT);

    }

}

更多信息可以在這里找到:https ://github.com/codepath/android_guides/wiki/Working-with-the-Soft-Keyboard


查看完整回答
反對(duì) 回復(fù) 2022-07-06
?
慕尼黑8549860

TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超11個(gè)贊

我從未使用過(guò) performClick,你不能使用 setOnClickListener 來(lái)捕捉點(diǎn)擊


tagSearchInput.setOnClickListener(new View.OnClickListener() {

        @Override

        public void onClick(View v) {

            //do somthing

        }

    });


查看完整回答
反對(duì) 回復(fù) 2022-07-06
  • 2 回答
  • 0 關(guān)注
  • 109 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)