dailog.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/AccountTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dip"
android:text="账号"
android:gravity="left"
/>
<EditText
android:id="@+id/AccountEditText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:scrollHorizontally="true"
android:autoText="false"
android:capitalize="none"
android:gravity="fill_horizontal"
/>
<TextView
android:id="@+id/PasswordTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dip"
android:text="密码"
android:gravity="left"
/>
<EditText
android:id="@+id/PasswordEidtText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:scrollHorizontally="true"
android:autoText="false"
android:capitalize="none"
android:gravity="fill_horizontal"
android:password="true"
/>
</LinearLayout>

Java代码:

package com.bet.test;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

public class Login extends Activity {
/** Called when the activity is first created. */
ProgressDialog p_dialog;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AlertDialog dialog = new AlertDialog.Builder(
Login.this)
.setTitle("登录提示")
.setMessage("是否登录")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
LayoutInflater factory = LayoutInflater
.from(Login.this);
final View DialogView = factory.inflate(
R.layout.dialog, null);
AlertDialog dlg = new AlertDialog.Builder(
Login.this)
.setTitle("登陆框")
.setView(DialogView)
.setPositiveButton("确定",
new DialogInterface.OnClickListener() {

@Override
public void onClick(
DialogInterface dialog,
int which) {
// TODO Auto-generated method
// stub
p_dialog = ProgressDialog
.show(Login.this,
"请等待",
"正在为您登录...",
true);
new Thread() {
public void run() {
try {
sleep(3000);
} catch (Exception e) {
e.printStackTrace();
} finally {
p_dialog.dismiss();
}
}
}.start();
}
})
.setNegativeButton("取消",
new DialogInterface.OnClickListener() {

@Override
public void onClick(
DialogInterface dialog,
int which) {
// TODO Auto-generated method
// stub
Login.this
.finish();
}
}).create();
dlg.show();

}
})
.setNegativeButton("退出", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
Login.this.finish();
}
}).create();
dialog.show();
}
}

更多相关文章

  1. Android密码明文密文切换
  2. android的service中在后台弹出提示框
  3. Mono登录界面记住密码的控件
  4. Android 图形密码
  5. Android:控件AutoCompleteTextView 自动提示
  6. Eclipse Android 代码自动提示功能
  7. [Android]解决EditText设置成密码模式改变提示字体的问题
  8. android 底座充电压力插拔,有概率没有提示音
  9. Android EditText 限制文本框输入的长度和提示信息

随机推荐

  1. Android NDK开发method GetStringUTFChar
  2. Android简明开发教程二:安装开发环境
  3. android页面全屏及状态栏和导航栏的(沉浸
  4. Android计量单位px,in,mm,pt,dp,dip,sp和
  5. Android系统布局——android.R.layout详
  6. Android(安卓)MVVM ViewModel
  7. 你的手机能升级到Android 4.0吗?所有手机
  8. ubuntu下挂载android sdcard
  9. Android 菜鸟历程6
  10. [Android] Android获取当前顶部Activity