Android 之 对话框

新建一个 DialogApp Android 工程

系统对话框 提示对话框



下面我们一步一步实现

1. 新建布局文件 res -> layout -> tip_dialog.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    >

    <Button
        android:id="@+id/btnTip"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="删除提示对话框" />

</LinearLayout>


3. 新建界面类  src ->  com.test.TipDialogActivity

package com.test;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

import com.example.dialogapp.R;

public class TipDialogActivity extends Activity {
	private Button btnTip;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tip_dialog);

		btnTip = (Button) findViewById(R.id.btnTip);

		btnTip.setOnClickListener(listener);
	}

	private OnClickListener listener = new OnClickListener() {

		public void onClick(View v) {
			// AlertDialog
			AlertDialog.Builder builder = new AlertDialog.Builder(TipDialogActivity.this);
			builder.setTitle("提示对话框");// 设置对话框的标题
			// 设置对话框的内容
			builder.setMessage("您是否要删除吗?");

			// 添加确定按钮
			builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {

				public void onClick(DialogInterface dialog, int which) {
					Toast.makeText(TipDialogActivity.this, "确定按钮被点击", Toast.LENGTH_SHORT).show();

				}
			});

			// 添加取消按钮
			builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {

				public void onClick(DialogInterface dialog, int which) {
					Toast.makeText(TipDialogActivity.this, "取消按钮被点击", Toast.LENGTH_SHORT).show();

				}
			});

			// 创建一个对话框
			AlertDialog dialog = builder.create();
			// 显示对话框
			dialog.show();

		}

	};
}



3. AndroidManifest.xml 全局配置文件 配置启动界面 com.test.TipDialogActivity

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dialogapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="7" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        
         <activity
            android:name="com.test.TipDialogActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
    </application>

</manifest>




4. 在 DialogApp 右键 -> Run As -> Android Application 发布到模拟器运行

系统对话框 列表对话框



下面我们一步一步实现

1. 新建布局文件 res -> layout -> list_dialog.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    >

    <Button
        android:id="@+id/btnTip"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="列表提示对话框" />

</LinearLayout>


3. 新建界面类  src ->  com.test.ListDialogActivity

package com.test;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

import com.example.dialogapp.R;

public class ListDialogActivity extends Activity {
	private Button btnTip;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.list_dialog);

		btnTip = (Button) findViewById(R.id.btnTip);

		btnTip.setOnClickListener(listener);
	}

	private OnClickListener listener = new OnClickListener() {

		public void onClick(View v) {
			// AlertDialog
			AlertDialog.Builder builder = new AlertDialog.Builder(ListDialogActivity.this);

			// 设置列表对话框的内容
			final String[] items = { "查看", "删除", "重命名" };
			builder.setItems(items, new DialogInterface.OnClickListener() {

				public void onClick(DialogInterface dialog, int which) {
					// which 索引号
					Toast.makeText(ListDialogActivity.this, items[which], Toast.LENGTH_SHORT).show();

				}
			});

			// 创建一个对话框
			AlertDialog dialog = builder.create();
			// 显示对话框
			dialog.show();

		}

	};
}



3. AndroidManifest.xml 全局配置文件 配置启动界面 com.test.ListDialogActivity

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dialogapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="7" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        
         <activity
            android:name="com.test.ListDialogActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
    </application>

</manifest>




4. 在 DialogApp 右键 -> Run As -> Android Application 发布到模拟器运行

系统对话框 单选列表对话框



下面我们一步一步实现

1. 新建布局文件 res -> layout -> single_list_dialog.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    >

    <Button
        android:id="@+id/btnTip"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="单选列表提示对话框" />

</LinearLayout>


3. 新建界面类  src ->  com.test.SingleDialogActivity

package com.test;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

import com.example.dialogapp.R;

public class SingleDialogActivity extends Activity {
	private Button btnTip;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.single_list_dialog);

		btnTip = (Button) findViewById(R.id.btnTip);

		btnTip.setOnClickListener(listener);
	}

	private OnClickListener listener = new OnClickListener() {
		private int selectIndex;

		public void onClick(View v) {
			// AlertDialog
			AlertDialog.Builder builder = new AlertDialog.Builder(SingleDialogActivity.this);

			// 设置单选列表对话框的内容
			final String[] items = { "默认输入法", "Google输入法" };
			int checkedItem = 1;// 哪个索引号的元素被选中
			selectIndex = checkedItem;
			builder.setSingleChoiceItems(items, checkedItem, new DialogInterface.OnClickListener() {

				public void onClick(DialogInterface dialog, int which) {
					selectIndex = which;// 保存索引号
					// Toast.makeText(SingleDialogActivity.this, items[which],
					// Toast.LENGTH_SHORT).show();
					// dialog.dismiss();//关闭对话框
				}
			});

			// 添加确定按钮
			builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {

				public void onClick(DialogInterface dialog, int which) {
					Toast.makeText(SingleDialogActivity.this, items[selectIndex], Toast.LENGTH_SHORT).show();

				}
			});

			// 创建一个对话框
			AlertDialog dialog = builder.create();
			// 显示对话框
			dialog.show();

		}

	};
}



3. AndroidManifest.xml 全局配置文件 配置启动界面 com.test.SingleDialogActivity

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dialogapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="7" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        
         <activity
            android:name="com.test.SingleDialogActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
    </application>

</manifest>




4. 在 DialogApp 右键 -> Run As -> Android Application 发布到模拟器运行

系统对话框 多选列表对话框



下面我们一步一步实现

1. 新建布局文件 res -> layout -> multiple_list_dialog.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    >

    <Button
        android:id="@+id/btnTip"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="多选列表提示对话框" />

</LinearLayout>


3. 新建界面类  src ->  com.test.MultipleDialogActivity

package com.test;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

import com.example.dialogapp.R;

public class MultipleDialogActivity extends Activity {
	private Button btnTip;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.multiple_list_dialog);

		btnTip = (Button) findViewById(R.id.btnTip);

		btnTip.setOnClickListener(listener);
	}

	private OnClickListener listener = new OnClickListener() {

		public void onClick(View v) {
			// AlertDialog
			AlertDialog.Builder builder = new AlertDialog.Builder(MultipleDialogActivity.this);

			// 设置列表对话框的内容
			final String[] items = { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" };
			final boolean[] checkedItems = { true, true, true, true, true, false, false };
			builder.setMultiChoiceItems(items, checkedItems, new DialogInterface.OnMultiChoiceClickListener() {

				public void onClick(DialogInterface dialog, int which, boolean isChecked) {

				}
			});

			builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {

				public void onClick(DialogInterface dialog, int which) {
					// 将所有选择都拿到 StringBuffer
					StringBuilder sb = new StringBuilder();
					for (int i = 0; i < items.length; i++) {
						// 是否被选中
						if (checkedItems[i]) {
							sb.append(items[i] + ",");
						}
					}

					Toast.makeText(MultipleDialogActivity.this, sb.toString(), Toast.LENGTH_SHORT).show();

				}
			});

			// 创建一个对话框
			AlertDialog dialog = builder.create();
			// 显示对话框
			dialog.show();

		}

	};
}



3. AndroidManifest.xml 全局配置文件 配置启动界面 com.test.MultipleDialogActivity

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dialogapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="7" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        
         <activity
            android:name="com.test.MultipleDialogActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
    </application>

</manifest>




4. 在 DialogApp 右键 -> Run As -> Android Application 发布到模拟器运行

自定义对话框 重命名对话框



下面我们一步一步实现

1. 新建布局文件 res -> layout -> rename_dialog.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="长按打开重命名对话框" />

</LinearLayout>


2.新建布局文件 res -> layout -> rename.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <EditText
        android:id="@+id/txtName"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:ems="10" >

        <requestFocus />
    </EditText>

    <Button
        android:id="@+id/btnOk"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="确定" />

</LinearLayout>


3. 新建界面类  src ->  com.test.RenameDialogActivity

package com.test;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.example.dialogapp.R;

public class RenameDialogActivity extends Activity {
	private TextView textView;

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

		textView = (TextView) findViewById(R.id.textView);

		textView.setOnLongClickListener(longListener);
	}

	private OnLongClickListener longListener = new OnLongClickListener() {
		private AlertDialog dialog;

		public boolean onLongClick(View v) {
			// 加载 res->layout->rename.xml
			View view = View.inflate(RenameDialogActivity.this, R.layout.rename, null);
			// 获得自定义文本引用
			final EditText txtName = (EditText) view.findViewById(R.id.txtName);
			// 将 textView 设置到 txtName
			txtName.setText(textView.getText());

			// 获得按钮引用
			Button btnOk = (Button) view.findViewById(R.id.btnOk);
			btnOk.setOnClickListener(new OnClickListener() {

				public void onClick(View v) {
					// 将 txtName 存回 textView
					textView.setText(txtName.getText());
					// 关闭对话框
					dialog.dismiss();
				}

			});

			AlertDialog.Builder builder = new AlertDialog.Builder(RenameDialogActivity.this);
			// 替换对话的布局
			builder.setView(view);

			dialog = builder.create();
			dialog.show();

			return false;
		}

	};
}



3. AndroidManifest.xml 全局配置文件 配置启动界面 com.test.RenameDialogActivity

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dialogapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="7" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        
         <activity
            android:name="com.test.RenameDialogActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
    </application>

</manifest>




4. 在 DialogApp 右键 -> Run As -> Android Application 发布到模拟器运行

自定义对话框 网格布局对话框



下面我们一步一步实现

复制图片到 res -> drawable-hdpi










1. 新建布局文件 res -> layout -> gridview.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <GridView
        android:id="@+id/gridView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:numColumns="3"
        android:verticalSpacing="30dp"
         />

</LinearLayout>



3. 新建界面类  src ->  com.test.GridViewActivity

package com.test;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.Toast;

import com.example.dialogapp.R;

public class GridViewActivity extends Activity {
	private GridView gridView;
	private int[] imageIds = {
			R.drawable.bingtai, 
			R.drawable.chatai,
			R.drawable.diancai, 
			R.drawable.gengxin, 
			R.drawable.jietai, 
			R.drawable.shezhi, 
			R.drawable.zhuantai, 
			R.drawable.zhuxiao };

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.gridview);

		gridView = (GridView) findViewById(R.id.gridView);
		gridView.setAdapter(new MyAdapter(this));

		// 添加选择事件
		gridView.setOnItemClickListener(itemListener);
	}

	private OnItemClickListener itemListener = new OnItemClickListener() {

		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			int imageId = imageIds[position];
			Toast toast = Toast.makeText(GridViewActivity.this, imageId, Toast.LENGTH_SHORT);

			ImageView imageView = new ImageView(GridViewActivity.this);
			imageView.setImageResource(imageId);

			// 替换toast view
			toast.setView(imageView);
			toast.show();

		}

	};

	class MyAdapter extends BaseAdapter {
		private Context context;

		public MyAdapter(Context context) {
			this.context = context;
		}

		// 小图片个数
		public int getCount() {
			return imageIds.length;
		}

		// 根据 位置 获得 图片对象
		public Object getItem(int position) {
			return imageIds[position];
		}

		public long getItemId(int position) {
			return position;
		}

		// 获得显示的图片View对象
		public View getView(int position, View convertView, ViewGroup parent) {
			int imageId = imageIds[position];

			ImageView imageView = new ImageView(context);
			imageView.setImageResource(imageId);

			return imageView;
		}

	}
}



3. AndroidManifest.xml 全局配置文件 配置启动界面 com.test.GridViewActivity

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dialogapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="7" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        
         <activity
            android:name="com.test.GridViewActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
    </application>

</manifest>




4. 在 DialogApp 右键 -> Run As -> Android Application 发布到模拟器运行

自定义对话框 游戏提示对话框



下面我们一步一步实现

复制图片到 res -> drawable-hdpi





1. 新建布局文件 res -> layout -> game.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="56dp"
        android:layout_marginTop="25dp"
        android:src="@drawable/dialog" />

    <ImageView
        android:id="@+id/btnOk"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/imageView1"
        android:layout_alignLeft="@+id/imageView1"
        android:layout_marginBottom="16dp"
        android:layout_marginLeft="26dp"
        android:src="@drawable/okbutton" />

    <ImageView
        android:id="@+id/btnCancel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/btnOk"
        android:layout_marginLeft="24dp"
        android:layout_toRightOf="@+id/btnOk"
        android:src="@drawable/cancelbutton" />

</RelativeLayout>


2.新建布局文件 res -> layout -> game_dialog.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    tools:context=".Android04Activity" >

    <Button
        android:id="@+id/btnTip"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="游戏对话框" />

</LinearLayout>



3. 新建界面类  src ->  com.test.GameDialogActivity

package com.test;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import com.example.dialogapp.R;

public class GameDialogActivity extends Activity {
	private Button btnTip;

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

		btnTip = (Button) findViewById(R.id.btnTip);

		btnTip.setOnClickListener(listener);
	}

	private OnClickListener listener = new OnClickListener() {

		private AlertDialog dialog;

		public void onClick(View v) {
			// AlertDialog
			AlertDialog.Builder builder = new AlertDialog.Builder(GameDialogActivity.this);

			// 加载 res->layout->game.xml
			View gameView = View.inflate(GameDialogActivity.this, R.layout.game, null);
			// 获得按钮对象
			ImageView btnOk = (ImageView) gameView.findViewById(R.id.btnOk);
			ImageView btnCancel = (ImageView) gameView.findViewById(R.id.btnCancel);
			// 设置点击事件
			btnOk.setOnClickListener(new OnClickListener() {

				public void onClick(View v) {
					Toast.makeText(GameDialogActivity.this, "确定点击", Toast.LENGTH_SHORT).show();
					dialog.dismiss();

				}
			});
			btnCancel.setOnClickListener(new OnClickListener() {

				public void onClick(View v) {
					Toast.makeText(GameDialogActivity.this, "取消点击", Toast.LENGTH_SHORT).show();
					dialog.dismiss();

				}
			});

			// 创建一个对话框
			dialog = builder.create();
			// 显示对话框
			dialog.show();

			// 替换对话框系统视图
			dialog.getWindow().setContentView(gameView);

		}

	};
}



3. AndroidManifest.xml 全局配置文件 配置启动界面 com.test.GameDialogActivity

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.dialogapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="7" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        
         <activity
            android:name="com.test.GameDialogActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
    </application>

</manifest>




4. 在 DialogApp 右键 -> Run As -> Android Application 发布到模拟器运行


Easy Learning Java


Easy Learning Design Patterns Java Practice


Easy Learning Data Structures & Algorithms Java Practice


Java Parsing Collection XML JSON


Easy Learning JDBC + MySQL


Easy Learning Javascript


Easy Learning Design Patterns Javascript


Easy Learning Design Patterns ES6+ Javascript


Easy Learning Data Structures & Algorithms Javascript


Easy Learning Data Structures & Algorithms ES6+Javascript


Easy Learning Oracle SQL


Easy Learning JDBC + Oracle


Easy Learning Python 3


Easy Learning Data Structures & Algorithms Python 3


Easy Learning Design Patterns Python 3


Easy Learning HTML CSS


Easy Learning MySQL SQL


Easy Learning C#


Easy Learning Data Structures & Algorithms C#


Easy Learning C


Easy Learning Data Structures & Algorithms C


Easy Learning Data Structures & Algorithms C++

Android 之 对话框