当前位置: 移动技术网 > IT编程>移动开发>Android > 解析android中的帮助、about、关于作者、HELP等提示页面

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

2019年07月24日  | 移动技术网IT编程  | 我要评论

喜悦网,水黛之碧落黄泉,超音速推进号

在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();

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网