當前位置:首頁 » 安卓系統 » androidedittext自定義

androidedittext自定義

發布時間: 2022-09-26 18:29:54

Ⅰ android自定義edittext 當有文字時怎麼禁止長按全選事件

你給復選框設置監聽事件,當選中的時候,就給edittext.setText如:checkbox.setOnCheckedChangeListener(newCompoundButton.OnCheckedChangeListener(){@(CompoundButtonbuttonView,booleanisChecked){//TODOAuto-generatedmethodstubif(isChecked){editText1.setText("選中");}else{editText1.setText("取消選中");}}});

Ⅱ android:自定義可輸入對話框,EditText已經獲得焦點,為什麼就是不彈出輸入法呢

因為你彈出的對話框跟MainActivity(假設你是在MainActivity上他彈出的)不在同一個Activity上,所以就顯示不出來了,就算你能看到軟鍵盤你也無法輸入。

Ⅲ android 中 如何控制activity中顯示的EditText的長度 即按照自己的想法定義長度

可以使用LayoutParams來設置,editText.setLayoutParams(new LayoutParams("24","30"));

Ⅳ android 自定義的dialog,edit text 不能獲得焦點,彈出軟鍵盤。

1、首先自定義布局
2、把自定義布局放入dialog中顯示
3、通過自定義布局查找對應的edittext組件
final View DialogView = a .inflate ( R.layout.loand, null);//1、自定義布局
//創建對話框
AlertDialog dlg = new AlertDialog.Builder(loand.this)
.setTitle("登錄框")
.setView(DialogView)//設置自定義對話框的樣式,2、自定義布局放入dialog中顯示
.setPositiveButton("登陸", //設置"確定"按鈕
new DialogInterface.OnClickListener() //設置事件監聽{
public void onClick(DialogInterface dialog, int whichButton){editText1 =(EditText) DialogView.findViewById(R.id.editText1);
editText2 =(EditText) DialogView.findViewById(R.id.editText2);//3、過自定義布局查找對應的edittext組件
String id = editText1.getText().toString();
String password = editText2.getText().toString();

Ⅳ 在android 裡面怎麼自定義一個EditText,而這個EditText只能輸入數字,請大俠們指教 有源碼就更好了

定義一個edittext
<EditText
android:id="@+id/newperson"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/newperson_hint"
android:focusable="true"
android:focusableInTouchMode="true"
android:numeric="integer"
/>

android:numeric="integer",說明你只能輸入數字;

Ⅵ android自定義edittext怎麼設置背景

JAVA中這樣寫:setBackgroundDrawable(new BitmapDrawable(("bg_focus.png")));

熱點內容
輕應用緩存 發布:2025-05-18 00:31:02 瀏覽:251
鳥存儲空氣 發布:2025-05-18 00:20:24 瀏覽:201
linux刻錄iso 發布:2025-05-18 00:16:15 瀏覽:663
php動態參數 發布:2025-05-18 00:12:05 瀏覽:425
安卓應用上傳 發布:2025-05-18 00:11:57 瀏覽:803
數對的演算法 發布:2025-05-18 00:11:02 瀏覽:382
linuxwhile 發布:2025-05-18 00:10:08 瀏覽:144
xpftp外網 發布:2025-05-17 23:58:11 瀏覽:386
如何評價一個伺服器的性能 發布:2025-05-17 23:40:53 瀏覽:271
淘寶客適合什麼伺服器 發布:2025-05-17 23:39:26 瀏覽:614