在android中,经常要用到帮助、about、关于作者等的提示页面。

类似这样的页面:

这样的页面,我们可以通过AlertDialog对话框来设计。

设计一个AboutDialog类继承于AlertDialog

public class AboutDialog extends AlertDialog {       public AboutDialog(Context context) {           super(context);           final View view = getLayoutInflater().inflate(R.layout.about,                   null);           setButton(context.getText(R.string.close), (OnClickListener) null);           setIcon(R.drawable.icon_about);           setTitle("超级笑话   v1.0.0" );           setView(view);       }   }  

对应的XML文件

1、layout布局文件about.xml

<?xml version="1.0" encoding="utf-8"?>  <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"      android:layout_width="fill_parent" android:layout_height="wrap_content">      <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"          android:layout_width="fill_parent" android:layout_height="fill_parent">            <TextView android:layout_height="fill_parent"              android:layout_width="fill_parent" android:text="@string/help_dialog_text"              android:padding="6dip" android:textColor="#FFFFFF" />      </ScrollView>  </FrameLayout>  

2、strings.xml

 <string name="help_dialog_text">      <i>作者: 空山不空</i>      \n       \n       <i>联系:ajie191@163.com</i>      \n     \n       <b>超级笑话---收集了2000多各种类型的笑料,让你全天笑不停!你还可以把笑话通过短信发给你的好友分享哦!</b>          \n       \n       <b>有任何建议或者反馈可以随时联系作者</b>    </string>  

然后在页面调用代码即可显示对话框

new AboutDialog(this).show();

更多相关文章

  1. Android欢迎页面2秒钟后自动跳转到主页面
  2. Android出现java.lang.RuntimeException: Can't toast on a thre
  3. SlidingMenu和ActionBarSherlock结合做出出色的App布局,Facebook
  4. Android横向智能刷新框架-SmartRefreshHorizontal+ScrollView 实
  5. 【Android】loadData与loadDataWithBaseURL的区别
  6. android ScreenObserver 实现打开锁屏键时,跳到指定的页面
  7. android WebView解析 调用html5页面
  8. Android评论留言页面
  9. Android(安卓)WebView 使用方法,可以解决web视频播放层级问题。

随机推荐

  1. 2017-2020历年字节跳动Android面试真题解
  2. 基于Android的温湿度采集系统
  3. Android(安卓)NDK之旅-OpenGL 初探
  4. WPS Office移动版(Android)限时免费,送小
  5. Android(安卓)将自己的Launcher设置为默
  6. Android(安卓)自定义数字键盘(一)
  7. 【构建Android缓存模块】(一)吐槽与原理分
  8. Android(安卓)nomedia 避免图片等资源泄
  9. windows下cygwin使用ndkr8编译ffmpeg
  10. 给android设备增加串口功能