Cha*_*ake 40
您可以使用Dialog轻松创建
使用上下文创建Dialog实例
Dialog dialog = new Dialog(contex);
Run Code Online (Sandbox Code Playgroud)
您可以根据需要设计布局.
您可以将此布局添加到对话框中
dialog.setContentView(R.layout.popupview);//popup view is the layout you created
然后您可以使用findViewById方法访问其内容(textviews等)
TextView txt = (TextView)dialog.findViewById(R.id.textbox);
Run Code Online (Sandbox Code Playgroud)
你可以在这里添加任何文字.文本可以存储在res\values中的String.xml文件中.
txt.setText(getString(R.string.message));
Run Code Online (Sandbox Code Playgroud)
然后最后显示弹出菜单
dialog.show();
Run Code Online (Sandbox Code Playgroud)
更多信息 http://developer.android.com/guide/topics/ui/dialogs.html
http://developer.android.com/reference/android/app/Dialog.html
| 归档时间: |
|
| 查看次数: |
132064 次 |
| 最近记录: |