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

在edittext上如何禁用鍵盤彈出?

How to disable keypad popup when on edittext?(在edittext上如何禁用鍵盤彈出?)
本文介紹了在edittext上如何禁用鍵盤彈出?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

在我的應用程序中,我所有屏幕的第一個視圖是 EditText,所以每次我進入屏幕時,屏幕鍵盤都會彈出.手動單擊 EditText 時如何禁用此彈出窗口并啟用它????

In my app the first view of all my screens is an EditText, so every time i go to a screen the onscreen keypad pops up. how can i disable this popingup and enable it when manually clicked on the EditText????

    eT = (EditText) findViewById(R.id.searchAutoCompleteTextView_feed);

    eT.setOnFocusChangeListener(new OnFocusChangeListener() {

        public void onFocusChange(View v, boolean hasFocus) {

            if(hasFocus){
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 
            imm.hideSoftInputFromWindow(eT.getWindowToken(), 0);
            }
        }
    });

xml代碼:

<ImageView
    android:id="@+id/feedPageLogo"
    android:layout_width="45dp"
    android:layout_height="45dp"
    android:src="@drawable/wic_logo_small" />

<Button
    android:id="@+id/goButton_feed"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:text="@string/go" />

<EditText
    android:id="@+id/searchAutoCompleteTextView_feed"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_toLeftOf="@id/goButton_feed"
    android:layout_toRightOf="@id/feedPageLogo"
    android:hint="@string/search" />

<TextView
    android:id="@+id/feedLabel"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/feedPageLogo"
    android:gravity="center_vertical|center_horizontal"
    android:text="@string/feed"
    android:textColor="@color/white" />

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ButtonsLayout_feed"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true" >

    <Button
        android:id="@+id/feedButton_feed"
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:layout_margin="0dp"
        android:layout_weight="1"
        android:background="@color/white"
        android:text="@string/feed"
        android:textColor="@color/black" />

    <Button
        android:id="@+id/iWantButton_feed"
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:layout_margin="0dp"
        android:layout_weight="1"
        android:background="@color/white"
        android:text="@string/iwant"
        android:textColor="@color/black" />

    <Button
        android:id="@+id/shareButton_feed"
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:layout_margin="0dp"
        android:layout_weight="1"
        android:background="@color/white"
        android:text="@string/share"
        android:textColor="@color/black" />

    <Button
        android:id="@+id/profileButton_feed"
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:layout_margin="0dp"
        android:layout_weight="1"
        android:background="@color/white"
        android:text="@string/profile"
        android:textColor="@color/black" />
</LinearLayout>

<ListView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/feedListView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_above="@id/ButtonsLayout_feed"
    android:layout_below="@id/feedLabel"
    android:textSize="15dp" >
</ListView>

第三個視圖(EditText)是焦點所在.

the third view (EditText) is where the focus is.

推薦答案

最好的解決方案在于Project Manifest文件(AndroidManifest.xml),在activity<中添加如下屬性/code> 構造

The best solution lies in the Project Manifest file (AndroidManifest.xml), add the following attribute in the activity construct

android:windowSoftInputMode="stateHidden"

android:windowSoftInputMode="stateHidden"

<小時>

示例:

    <activity android:name=".MainActivity" 
              android:windowSoftInputMode="stateHidden" />

說明:

  • 當 Activity 成為用戶關注的焦點時,軟鍵盤的狀態(無論是隱藏還是可見).
  • 對 Activity 的主窗口所做的調整——無論是縮小它的大小以便為軟鍵盤騰出空間,還是當窗口的一部分被軟鍵盤覆蓋時,它的內容是否平移以使當前焦點可見.

引入于:

  • API 級別 3.

文檔鏈接

注意:此處設置的值(stateUnspecified"和adjustUnspecified"除外)會覆蓋主題中設置的值.

這篇關于在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 中的數值?)
主站蜘蛛池模板: 日韩欧美一区二区在线播放 | 日韩在线免费播放 | 九九热在线视频 | www.精品国产 | 精品国产免费一区二区三区演员表 | 91免费在线看 | 狠狠干av| 爽爽免费视频 | 欧美亚洲免费 | 亚洲午夜精品 | 国产激情精品 | 欧美日韩国产在线观看 | 欧美精品在线一区 | 国产精品视频一区二区三区四区国 | 99久久99久久精品国产片果冰 | 亚洲激精日韩激精欧美精品 | 欧美成人精品一区二区三区 | 久久免费精品视频 | 国产1区在线 | 欧美一级免费片 | 精品国产精品国产偷麻豆 | 欧美日韩国产精品激情在线播放 | 国产精品久久久久久久久久久久午夜片 | jlzzxxxx18hd护士 | 亚洲国产成人av | 欧美视频1区 | 在线观看亚 | 日韩在线免费 | 激情一区二区三区 | 91精品国产自产精品男人的天堂 | 中文av电影 | ririsao久久精品一区 | 午夜影院在线观看 | 欧美在线资源 | 四虎影院在线观看免费视频 | 免费av播放 | 一区二区免费高清视频 | 久久午夜精品 | 免费一级做a爰片久久毛片潮喷 | 日本久久综合 | 一区二区三区亚洲 |