android對話框輸入框
Ⅰ android 如何設計彈出一個輸入框 這個小窗口可以輸入,然後下面有確認和取消兩個按鈕
你好,請參考這篇文章。
http://www.cnblogs.com/salam/archive/2010/11/15/1877512.html
如果有技術難點可以Q我。103五六88三二七
Ⅱ Android 輸入法對話框的布局
顯然不行 除非你自己寫 輸入法是一個應用 布局是他們自己寫的 只能是按照手機方向來顯示 查看原帖>>
Ⅲ android中怎麼設置一個日期的自定義對話框
在用戶點擊輸入框或者輸入框獲得焦點的時候彈出來DatePickerDialog,用戶點擊設定按鈕,將日期填寫到輸入框。
下面直接上代碼:
[html] view plain print?
<EditText
android:id="@+id/Birthday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dip"
android:layout_marginRight="30dip"
android:inputType="none"//不顯示系統輸入鍵盤
android:layout_weight="1" >
</EditText>
[java] view plain print?
birthday = (EditText)findViewById(R.id.Birthday);
birthday.setInputType(InputType.TYPE_NULL); <span style="font-family: Arial, Helvetica, sans-serif;">//不顯示系統輸入鍵盤</span>
birthday.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
if(hasFocus){
Calendar c = Calendar.getInstance();
new DatePickerDialog(ProfileActivity.this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
// TODO Auto-generated method stub
birthday.setText(year+"/"+(monthOfYear+1)+"/"+dayOfMonth);
}
}, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)).show();
}
}
});
birthday.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Calendar c = Calendar.getInstance();
new DatePickerDialog(ProfileActivity.this, new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
// TODO Auto-generated method stub
birthday.setText(year+"/"+(monthOfYear+1)+"/"+dayOfMonth);
}
}, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)).show();
}
});
Ⅳ android 怎樣彈出選擇輸入法的對話框 如下圖
1.讓EditText失去焦點,使用EditText的clearFocus方法2.強制隱藏Android輸入法窗口,在IME類中我們通過InputMethodManagerimm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);實例化輸入法控制對象,通過hideSoftInputFromWindow來控制,其中第一個參數綁定的為需要隱藏輸入法的EditText對象,比如imm.hideSoftInputFromWindow(etAndroid123.getWindowToken(),0);
Ⅳ android如何實現一個彈出輸入對話框呢
AlertDialog.Builderbuilder=newAlertDialog.Builder(context);
builder.setTitle("提示");
builder.setMessage("恭喜你,注冊成功!");
builder.setPositiveButton("去登錄",newDialogInterface.OnClickListener(){ //增加一個成功按鈕,並增加點擊事件
@Override
publicvoidonClick(DialogInterfacedialog,intwhich){
//點擊去登錄的操作
}
});
builder.setNegativeButton("繼續注冊",newDialogInterface.OnClickListener(){ //增加一個中間的按鈕,並增加點擊事件
@Override
publicvoidonClick(DialogInterfacedialog,intwhich){
//點擊繼續注冊的操作
}
});
builder.setCancelable(false); //彈出框不可以按返回取消
AlertDialogdialog=builder.create(); //創建對話框
dialog.setCanceledOnTouchOutside(false); //設置對話框失去焦點不會消息
dialog.show(); //彈出
Ⅵ android:自定義可輸入對話框,EditText已經獲得焦點,為什麼就是不彈出輸入法呢
因為你彈出的對話框跟MainActivity(假設你是在MainActivity上他彈出的)不在同一個Activity上,所以就顯示不出來了,就算你能看到軟鍵盤你也無法輸入。
Ⅶ android 彈出輸入框並得到輸入框的結果
不用找了,這才是正解。你的需求其實是,需要一個阻塞式對話框,安卓本身所有彈窗都是非阻塞的。
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.widget.EditText;
/**
* 動態獲取用戶輸入後在繼續後面的流程
* 這是一個模態阻塞對話框(阻塞主線程,結果不用回調來處理)
*/
public class BlockingInputDialog {
String mInputString = "";
Activity mContext;
String mTitle;
EditText mEditText;
Handler mHandler;
public BlockingInputDialog(Activity context, String title){
mContext = context;
mTitle = title;
}
public String showDialog(){
mHandler = new Handler(){
@Override
public void handleMessage(Message msg) {
//super.handleMessage(msg);
throw new RuntimeException();
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle(mTitle);
builder.setCancelable(false);
mEditText = new EditText(mContext);
builder.setView(mEditText);
builder.setPositiveButton("確定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
mInputString = mEditText.getText().toString();
Message message = mHandler.obtainMessage();
mHandler.sendMessage(message);
}
});
builder.setNegativeButton("取消", null);
builder.create().show();
try {
Looper.getMainLooper().loop();
}
catch(RuntimeException e2)
{
}
return mInputString;
}
}
Ⅷ android 對話框 如何 獲取輸入框值
String name=username.getText().toString();
String pass=password.getText().toString();
把它們寫到這個監聽器的外面來試試。
Ⅸ android怎樣實現彈出多個輸入對話框
1.布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:background="#ffffffff" android:orientation="horizontal"
android:id="@+id/dialog">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/tvname" android:text="姓名:" />
<EditText android:layout_height="wrap_content"
android:layout_width="wrap_content" android:id="@+id/etname" android:minWidth="100dip"/>
</LinearLayout>
2.調用代碼
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.dialog,
(ViewGroup) findViewById(R.id.dialog));
new AlertDialog.Builder(this).setTitle("自定義布局").setView(layout)
.setPositiveButton("確定", null)
.setNegativeButton("取消", null).show();
簡單來說就是自定義dialog就好了
在裡面創建兩個對話框,也就是edittext
你試試看我這個代碼。
Ⅹ android 對話框輸入的內容顯示到列表上如何實現
簡單的說:
1. 一個TextView 用戶在這里輸入內容
2. 獲取TextView中用戶輸入的內容
3. 一個ListView,將從TextView中獲取的內容顯示
4. 如果以上所有步驟你都不會的話,我的建議是,將Android的基礎好好學習下!