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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

當我觸摸 AppCompatEditText 時,鍵盤是不可見的

當我觸摸 AppCompatEditText 時,鍵盤是不可見的

慕妹3242003 2022-05-12 15:35:54
我創(chuàng)建了從 AppCompatEditText 擴展的類 ComplexEditText。我確定了我的背景變體: setBackground(getResources().getDrawable(R.drawable.backgroundedittext));我解決了填充:setPadding((int) (16 * scale), (int) (10 * scale), (int) (17 * scale), (int) (13 * scale));我創(chuàng)建了清除輸入文本的按鈕mClearButtonImage = ResourcesCompat.getDrawable(getResources(), R.mipmap.delete_button, null);但問題是當我觸摸我的自定義視圖(從 AppCompatEditText 擴展)時,鍵盤沒有打開。我試過:setClickable(true)setFocusable(true)setShowSoftInputOnFocus(true);nputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);    imm.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT);我在 AndroidManifes.xml 中安頓下來:android:windowSoftInputMode="adjustResize" 它也不起作用。鍵盤沒有出現。AndroidManifest.xml    <?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    package="com.royallogistics.yegor.royallogistics">    <uses-permission android:name="android.permission.INTERNET" />    <uses-permission android:name="android.permission.READ_PHONE_STATE" />    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />    <application        android:name=".service.AppChannel"        android:allowBackup="true"        android:icon="@mipmap/ic_launcher"        android:label="@string/app_name"        android:roundIcon="@mipmap/ic_launcher_round"        android:supportsRtl="true"        android:theme="@style/AppTheme"        tools:ignore="GoogleAppIndexingWarning">        <activity android:name=".LoginActivity" />        <activity android:name=".SubordersDinamicsFields"            android:windowSoftInputMode="stateVisible">        </activity>
查看完整描述

1 回答

?
嗶嗶one

TA貢獻1854條經驗 獲得超8個贊

我在構造函數中添加以下行:


clearFocus();

我在 onTouch 方法中添加以下代碼:


                requestFocus();

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

                imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);



查看完整回答
反對 回復 2022-05-12
  • 1 回答
  • 0 關注
  • 243 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號