关于带有可滚动文本和网页按钮的对话框
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于带有可滚动文本和网页按钮的对话框相关的知识,希望对你有一定的参考价值。
//In for instance onOptionsItemSelected event call showDialog(MY_ABOUT_DLG_CONSTANT); //Then override the onCreateDialog event, and check for //the int constant that you passed in showDialog. @Override switch (id) { case MY_ABOUT_DLG_CONSTANT: { /* Use the alert dialog builder to create the dialog, and add the string constants "R.string.aboutXXX" in "strings.xml". Then also add a dialog.xml layout. */ AlertDialog.Builder d = new AlertDialog.Builder(this); d.setTitle(R.string.aboutTitle); d.setPositiveButton(R.string.aboutHomepage, new OnClickListener() { public void onClick(DialogInterface dialog, int which) { Uri uri = Uri.parse(getString(R.string.aboutHomepageUrl)); startActivity(new Intent(Intent.ACTION_VIEW, uri)); } }); //Just add additional buttons like the button above but add them //using d.setNeutralButton instead of positive button. d.setNegativeButton(R.string.aboutClose, null); TextView text = (TextView) v.findViewById(R.id.dialogText); text.setText(getString(R.string.aboutText, getVersion())); d.setView(v); return d.create(); } } } /****************** dialog.xml layout ******************** <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="6dip"> <TextView android:id="@+id/dialogText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="12sp" android:text="Example text." /> </ScrollView> *******************/
以上是关于关于带有可滚动文本和网页按钮的对话框的主要内容,如果未能解决你的问题,请参考以下文章