解析android中的帮助、about、关于作者、HELP等提示页面

所属分类: 软件编程 / Android 阅读数: 698
收藏 0 赞 0 分享
在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>联系:www.jb51.net</i>
    \n
    \n 
    <b>超级笑话---收集了2000多各种类型的笑料,让你全天笑不停!你还可以把笑话通过短信发给你的好友分享哦!</b>    
    \n 
    \n 
    <b>有任何建议或者反馈可以随时联系作者</b>  
</string> 

然后在页面调用代码即可显示对话框
new AboutDialog(this).show();

更多精彩内容其他人还在看

Android 动画之AlphaAnimation应用详解

本节讲解AlphaAnimation 动画,窗口的动画效果,淡入淡出什么的,有些游戏的欢迎动画,logo的淡入淡出效果就使用AlphaAnimation,具体的祥看本文,需要的朋友可以参考下
收藏 0 赞 0 分享

Android 动画之TranslateAnimation应用详解

本节讲解TranslateAnimation动画,TranslateAnimation比较常用,比如QQ,网易新闻菜单条的动画,就可以用TranslateAnimation实现,本文将详细介绍通过TranslateAnimation 来定义动画,需要的朋友可以参考下
收藏 0 赞 0 分享

Android 动画之ScaleAnimation应用详解

本节讲解ScaleAnimation 动画在应用中的实现,有需要的朋友可以参考下
收藏 0 赞 0 分享

Android 动画之RotateAnimation应用详解

本节讲解旋转动画效果RotateAnimation方法的应用,有需要的朋友可以参考下
收藏 0 赞 0 分享

Android开发之文件操作模式深入理解

本文将介绍Android开发之文件操作模式,需要了解的朋友可以参考下
收藏 0 赞 0 分享

Android应用程序窗口(Activity)窗口对象(Window)创建指南

本文将详细介绍Android应用程序窗口(Activity)的窗口对象(Window)的创建过程,需要了解的朋友可以参考下
收藏 0 赞 0 分享

android activity设置无标题实现全屏

本文将详细介绍Android如何设置Activity全屏和无标题的实现方法,需要的朋友可以参考下
收藏 0 赞 0 分享

Android启动模拟器报错解决方法

本文将详细介绍Android模拟器报"Failed To Allocate memory 8"错误的解决办法,需要了解的朋友可以参考下
收藏 0 赞 0 分享

Android如何实现非本地图片的点击态

Android如何实现非本地图片的点击态,本文提供了详细的实现代码,需要了解的朋友可以参考下
收藏 0 赞 0 分享

android viewpaper实例探讨

本文将提供一个android viewpaper实例实现过程,需要了解更多的朋友可以参考下
收藏 0 赞 0 分享
查看更多