當前位置:首頁 » 安卓系統 » androidedittext遮擋

androidedittext遮擋

發布時間: 2022-06-25 22:45:03

⑴ Android EditText 問題

首先我覺得hint的用途就是提示效果,當你在編輯框輸入了數據,hint就變得無意義了。至於你說的實體和hint要共存,可以換成其他的方法實現:第一個就是每一行一個textview+edittext ,第二種方法就是「給edittext」設置屬性「android:drawableLeft="xxxx"」(xxx放一張寫有實體的.PNG圖片)

至於數游標的位置要重定向,要是按照layout的布局的中順序,你的「賬號」實體也是edittext。理應先獲取聚焦,是否可以嘗試下在代碼中使用第一個賬號實體的edittext對象的方法(findFocus())還有在布局的文件中設置該edittext控制項添加試試

<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="5"
android:minLines="1"
android:maxLength="50"
android:hint="總感覺很空,寫點什麼吧!"
android:inputType="textMultiLine" >
<requestFocus />------------->添加這個
</EditText>

⑵ android 去掉沉浸式edittext還是被軟鍵盤遮住了

在程序中加入以下代碼時,軟鍵盤會出現: InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN); 如果要讓軟鍵盤消失,則為以下代碼: InputMethod...

⑶ android EditText在獲得焦點的時候下面的Tab被輸入法頂上去了

在對應的Activity聲明中加一個這個屬性試試
android:windowSoftInputMode="adjustPan"

⑷ 怎麼把android軟鍵盤把布局頂上去

在EditText控制項接近底部的情況下,軟鍵盤彈出後會把獲得焦點的EditText控制項遮擋,無法看到輸入信息,防止這樣的情況發生,就需要設置AndroidManifest.xml的屬性:
前面的xml信息省略
在activity中 增加android:windowSoftInputMode="adjustPan"
<activity
..
android:windowSoftInputMode="adjustPan"
>
</activity>
彈出軟鍵盤以後,軟鍵盤會把EditText推上去。

⑸ 在android中點擊EditText的時候會彈出軟鍵盤,這時候如果想隱藏軟鍵盤或者填完內容後點其他的地方直接隱藏

1)在Manifest.xml文件中相應的activity下添加一下代碼:
android:windowSoftInputMode="stateHidden"

2)讓EditText失去焦點,使用EditText的clearFocus方法
例如:EditText edit=(EditText)findViewById(R.id.edit);
edit.clearFocus();

3)強制隱藏Android輸入法窗口
例如:EditText edit=(EditText)findViewById(R.id.edit);
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edit.getWindowToken(),0);

4).EditText始終不彈出軟體鍵盤
例:EditText edit=(EditText)findViewById(R.id.edit);
edit.setInputType(InputType.TYPE_NULL);

⑹ 新手關於android studio中edittext問題

  1. editText.getText().toString()獲取EditText控制項輸入的內容,onClick()方法表示點擊的時候執行裡面的代碼

  2. 放置在外面表示啟動當前Activity就執行了editText.getText().toString()方法,這個時候EditText控制項還沒有輸入任何東西,自然是空的

  3. 當把editText.getText().toString()放置在onClick()方法裡面,表示在大家按鈕的時候執行上面方法,如果這個時候不輸入任何內容,點擊按鈕,自然也是空的(原理和放置在外面一樣)

⑺ android每當輸入新的EditText數據,TextView里的append就會覆蓋原有的數據,如何不覆蓋原有的數據

可以使用intent把輸入的數據傳過去後再使用append追加,如果不行,那你就直接在Activity1追加後再傳去Activivty2

⑻ android 如何去掉edittext邊框

java">將edittext的style設置成?android:attr/textViewStyle取消掉默認的樣式,在設置background為@null接下來就是一個空空的edittext了(比如http://www.tiecou.com/)
,在兩個edittext中間加一個view,設置background為灰色,寬度match_parent,高度2dip看看。

RelativeLayoutxmlns:android="

xmlns:tools="

android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@android:color/white"
android:orientation="vertical">

<EditText
style="?android:attr/textViewStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:hint="輸入用戶名"
android:paddingBottom="5dip"
android:paddingTop="5dip"/>

<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="@android:color/darker_gray"/>

<EditText
style="?android:attr/textViewStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:hint="輸入密碼"
android:inputType="textPassword"
android:paddingBottom="5dip"
android:paddingTop="5dip"/>
</LinearLayout>
</RelativeLayout>

⑼ Android當重新輸入內容時,把之前edittext的內容覆蓋

在edittext獲取焦點的時候給edittext.setText("");設個空字元串就好了 希望對你有幫助.

熱點內容
阿里雲伺服器查看流量 發布:2025-07-02 17:44:42 瀏覽:838
c怎麼編譯c程序 發布:2025-07-02 17:30:58 瀏覽:293
安卓手機變成蘋果手機怎麼保存 發布:2025-07-02 17:20:24 瀏覽:192
負源碼怎麼算 發布:2025-07-02 16:59:42 瀏覽:595
自設計演算法 發布:2025-07-02 16:48:19 瀏覽:785
mac搭建阿里雲伺服器 發布:2025-07-02 16:48:17 瀏覽:443
存儲體的構成 發布:2025-07-02 16:47:41 瀏覽:148
初識java 發布:2025-07-02 16:45:48 瀏覽:409
移動華為悅盒如何配置 發布:2025-07-02 16:39:18 瀏覽:39
電腦緩存不了視頻怎麼下載不了 發布:2025-07-02 16:34:55 瀏覽:274