android的幫助、about、關於作者、HELP等的提示頁面

android的幫助、about、關於作者、HELP等的提示頁面

在android中,經常要用到幫助、about、關於作者等的提示頁面。

類似這樣的頁面:

這樣的頁面,我們可以通過AlertDialog對話框來設計。

設計一個AboutDialog類繼承於AlertDialog

public class AboutDialog extendsAlertDialog {  
    publicAboutDialog(Context context) {  
        super(context);  
        finalView 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>聯繫:[email protected]</i> 
    \n
    \n  
    <b>超級笑話---收集了2000多各種類型的笑料,讓你全天笑不停!你還可以把笑話通過短信發給你的好友分享哦!</b>     
    \n  
    \n  
    <b>有任何建議或者反饋可以隨時聯繫作者</b>   
</string>  

 然後在頁面調用代碼即可顯示對話框

new AboutDialog(this).show();




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章