Android自定义对话框(Dialog)位置,大小
2013-08-14 14:13
591 查看
代码
View Code
package com.and.mydialog; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class MyDialogActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button button = (Button) findViewById(R.id.button1); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // Dialog dialog = new MyDialog(MyDialogActivity.this, // R.style.MyDialog); //此处直接new一个Dialog对象出来,在实例化的时候传入主题 Dialog dialog = new Dialog(MyDialogActivity.this, R.style.MyDialog); //设置它的ContentView dialog.setContentView(R.layout.dialog); dialog.show(); } }); } }
View Code
相关文章推荐
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置 大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小(Service中同样适用)
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小