自定义对话框

时间:2015-09-17 13:05:19
【文件属性】:
文件名称:自定义对话框
文件大小:78KB
文件格式:ZIP
更新时间:2015-09-17 13:05:19
自定义对话框 自定义对话框样式public class DialogDemoActivity extends Activity { /** Called when the activity is first created. */ private Button btn=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); btn= (Button)findViewById(R.id.button1); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub //第一种方法 //第二个参数:这个对话框大体长什么样 // Dialog dialog1=new Dialog(DialogDemoActivity.this,R.style.MyDialog111); // //设置这个对话框的界面长什么样 // dialog1.setContentView(R.layout.dialog_new); // dialog1.show(); //第二种方法 //向上转型 Dialog dialog2=new MyDialog(DialogDemoActivity.this, R.style.MyDialog111); dialog2.show(); //只能调用父类和子类共有的成员,并且执行的是子类的成员(因为是子类生成的对象,父类没生成对象—) } }); } }
【文件预览】:
dialogDemo
----AndroidManifest.xml(679B)
----res()
--------layout()
--------drawable-ldpi()
--------drawable-mdpi()
--------drawable-hdpi()
--------values()
----proguard.cfg(1KB)
----src()
--------sn()
----bin()
--------classes.dex(4KB)
--------resources.ap_(23KB)
--------sn()
--------dialogDemo.apk(27KB)
----.classpath(280B)
----assets()
----default.properties(362B)
----.project(846B)
----gen()
--------sn()

网友评论