关于带有可滚动文本和网页按钮的对话框

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于带有可滚动文本和网页按钮的对话框相关的知识,希望对你有一定的参考价值。

  1. //In for instance onOptionsItemSelected event call
  2. showDialog(MY_ABOUT_DLG_CONSTANT);
  3.  
  4.  
  5. //Then override the onCreateDialog event, and check for
  6. //the int constant that you passed in showDialog.
  7. @Override
  8. protected Dialog onCreateDialog(int id) {
  9. switch (id) {
  10. case MY_ABOUT_DLG_CONSTANT: {
  11. /*
  12. Use the alert dialog builder to create the dialog, and add the string constants "R.string.aboutXXX" in
  13. "strings.xml". Then also add a dialog.xml layout.
  14. */
  15. AlertDialog.Builder d = new AlertDialog.Builder(this);
  16. d.setTitle(R.string.aboutTitle);
  17. d.setIcon(android.R.drawable.ic_menu_info_details);
  18. d.setPositiveButton(R.string.aboutHomepage, new OnClickListener() {
  19. public void onClick(DialogInterface dialog, int which) {
  20. Uri uri = Uri.parse(getString(R.string.aboutHomepageUrl));
  21. startActivity(new Intent(Intent.ACTION_VIEW, uri));
  22. }
  23. });
  24.  
  25. //Just add additional buttons like the button above but add them
  26. //using d.setNeutralButton instead of positive button.
  27.  
  28. d.setNegativeButton(R.string.aboutClose, null);
  29. View v = LayoutInflater.from(this).inflate(R.layout.dialog, null);
  30. TextView text = (TextView) v.findViewById(R.id.dialogText);
  31. text.setText(getString(R.string.aboutText, getVersion()));
  32. d.setView(v);
  33. return d.create();
  34. }
  35. }
  36. }
  37.  
  38. /******************
  39. dialog.xml layout
  40. ********************
  41.  
  42.  
  43. <?xml version="1.0" encoding="utf-8"?>
  44. <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  45. android:layout_width="fill_parent" android:layout_height="fill_parent"
  46. android:padding="6dip">
  47. <TextView android:id="@+id/dialogText" android:layout_width="fill_parent"
  48. android:layout_height="wrap_content" android:textSize="12sp"
  49. android:text="Example text." />
  50. </ScrollView>
  51.  
  52. *******************/

以上是关于关于带有可滚动文本和网页按钮的对话框的主要内容,如果未能解决你的问题,请参考以下文章

如何将对话框锚定到listview qt qml中的按钮

javascript点击按钮弹出文本框,用户可输入

JavaScript 基础学习

带有进度对话框取消的 Android AsyncTask

使用 Java 代码操作 MFC 对话框可执行文件

javascript学习笔记