相关疑难解决方法(0)

如何在对话框中创建edittext框

我正在尝试在对话框中创建一个edittext框来输入密码.当我在做的时候,我无法做到.我是初学者.请帮帮我.

public class MainActivity extends Activity {

Button create, show, setting;
//String pass="admin";String password;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    create = (Button)findViewById(R.id.amcreate);
    setting = (Button)findViewById(R.id.amsetting);
    show = (Button)findViewById(R.id.amshow);
    //input = (EditText)findViewById(R.id.this);

    setting.setVisibility(View.INVISIBLE);

    create.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Intent myIntent1 = new Intent(view.getContext(), Create.class);
            startActivityForResult(myIntent1, 0);
        }

    });

    show.setOnClickListener(new View.OnClickListener() {
        //@SuppressWarnings("deprecation")
        public void onClick(final View view) {

            // Creating alert Dialog with one Button
            AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this);

            //AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create(); …
Run Code Online (Sandbox Code Playgroud)

android dialog android-edittext

196
推荐指数
6
解决办法
25万
查看次数

Android:正面,负面和中性按钮之间的区别

正面,负面和中性按钮之间是否存在功能差异,特别是在AlertDialogs的上下文中?

android button android-alertdialog

30
推荐指数
3
解决办法
2万
查看次数