當前位置:首頁 » 安卓系統 » androidedittext圖文

androidedittext圖文

發布時間: 2023-02-01 16:07:53

1. 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>

2. 【Android程序開發】EditText詳解

EditText 是一個輸入框,在Android開發中是常用的控制項。也是獲取用戶數據的一種方式。
EditText TextView 的子類,它繼承了 [TextView] 的所有屬性。

Xml搭建界面

MainActivity.java

運行效果:

今天上午沒有拿眼鏡,然後作為一個近視,很痛苦的上了一上午的課,然後上課就跟不上進度,難受。事實證明,要愛護好自己的視力

3. 關於Android 的EditText布局

android:paddingTop="10dp"
android:paddingBottom="10dp"

4. android 我在edittext中輸入圖文。是用轉化為html實現的。我想問下如何保存每次輸進

可以使用getText()方法獲取內容保存在String變數中

5. 如何實現一個 Android 端的富文本編輯器

你好,
較常見的實現圖文混排的辦法

WebView + JavaScript;
EditText + Span;
scrollview + view;
WebView + JavaScript
webview實現富文本也就是html+css+js,不過這種的難點就是在手機客戶端中的編輯問題,畢竟是webview和android view的轉化問題。
EditText + Span
可以很好的實現簡單富文本的編輯,但是在圖文混排,以及各種主要自定義的組件面前就顯得捉襟見肘。
scrollview + view
優點是可以實現各種各樣的view,想什麼組件自定義就行,而且實現比較簡單,簡單幾句就可以實現文本插入編輯。
scrollview + view的實現過程
效果圖:

首先,先定義一個組件的介面;

一個組件的點擊介面,可根據組件選擇實現的方法;

然後定義兩個簡單的組件 RichEditText 和RichImageView;

實現一個簡單的圖片組件;

定義了兩個簡單的組件之後,接下來就是最後的組件管理器RichSrcollView,對組件的增刪其實也是最基本的addview和removeview,管理器實現了組件的點擊事件,鍵盤的回退刪除,組件的插入方法等待;

點擊按鈕的時候就新建一個圖片組件,而文本框組件可以點擊組件下面的空白條插入;

其他
在scrollview實現一些view的添加和刪除,以及組件間的拼接,就可以實現一個很簡單的可定製的富文本編輯器。

6. Android的EditText長按只顯示上面的復制粘貼菜單,不要彈出下面的輸入法鍵盤怎麼做

4.0以上的API禁止EditText彈出鍵盤需要這樣寫:

4.0的是setShowSoftInputOnFocus,4.2的是setSoftInputOnFocus。

EditTexteditText;
//editText的實例化我不寫了
InputMethodManagerimm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(e1.getWindowToken(),0);
try{
Class<EditText>cls=EditText.class;
setSoftInputShownOnFocus=cls.getMethod("setShowSoftInputOnFocus",boolean.class);
setSoftInputShownOnFocus.setAccessible(true);
setSoftInputShownOnFocus.invoke(editText,false);
}catch(Exceptione){
e.printStackTrace();
}

並且還要在配置文件裡面加上android:windowSoftInputMode="stateHidden"

4.0以下的可用editText.setInputType(InputType.TYPE_NULL);

或者直接在XML進行屬性設置。

如果對4.0以上系統的操作這句代碼,EditText將會沒有游標。

7. android EditText輸入文字 數字時 裡面的圖片文字怎麼消失 用的是哪個屬性

你說的是在EditText有個水印,輸入的時候水印消失的效果吧?你再EditText的XML中加入android:hint=「請輸入用戶名」,運行時EditText就會有一個「請輸入用戶名」的水印,當你輸入任何字元時,水印消失,刪除所有字元後水印又會出來,你還可以用android:textColorHint="顏色值"來設置水印文字的顏色哦。在java代碼中可以使用對應的方法實現這些功能,分別是
setHint(水印文字)和setHintTextColor(顏色值)

8. android edittext 如何用低級界面方法畫出來

不明白你的意思,edittext是用來輸入文本的,畫出來是什麼意思

setContentView(new EditText(this),new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));就可以在一個activity里放一個 EditText了

9. android開發EditText


EditTextet1=(EditText)findViewById(R.id.editText1);

EditTextet2=(EditText)findViewById(R.id.editText2);


EditTextet3=(EditText)findViewById(R.id.editText3);


et1.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);


et2.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_FLAG_CAP_WORDS);


et3.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);


或者在xml中設置


<EditText


android:id="@+id/editText1"


android:layout_width="fill_parent"


android:layout_height="100dp"


android:inputType="textCapSentences|textAutoCorrect">


</EditText>


<EditText


android:id="@+id/editText2"


android:layout_width="fill_parent"


android:layout_height="100dp"


android:layout_marginTop="10dp"


android:inputType="textCapWords|textAutoCorrect"/>


<EditText


android:id="@+id/editText3"


android:layout_width="fill_parent"


android:layout_height="100dp"


android:layout_marginTop="10dp"


android:inputType="textCapCharacters|textAutoCorrect"/>


注意:必須使用谷歌的輸入法,才起作用

10. android Material主題 EditText 這種效果[圖]

用TextInputLayout這個控制項即可,比如:

<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp">

<EditText
android:id="@+id/et_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="請輸入密碼"
android:inputType="text"
android:maxLines="1"
android:singleLine="true"/>

</android.support.design.widget.TextInputLayout>
熱點內容
內置存儲卡可以拆嗎 發布:2025-05-18 04:16:35 瀏覽:336
編譯原理課時設置 發布:2025-05-18 04:13:28 瀏覽:378
linux中進入ip地址伺服器 發布:2025-05-18 04:11:21 瀏覽:612
java用什麼軟體寫 發布:2025-05-18 03:56:19 瀏覽:32
linux配置vim編譯c 發布:2025-05-18 03:55:07 瀏覽:107
砸百鬼腳本 發布:2025-05-18 03:53:34 瀏覽:944
安卓手機如何拍視頻和蘋果一樣 發布:2025-05-18 03:40:47 瀏覽:741
為什麼安卓手機連不上蘋果7熱點 發布:2025-05-18 03:40:13 瀏覽:803
網卡訪問 發布:2025-05-18 03:35:04 瀏覽:511
接收和發送伺服器地址 發布:2025-05-18 03:33:48 瀏覽:372