解析android中的幫助、about、關(guān)于作者、HELP等提示頁(yè)面
更新時(shí)間:2013年06月19日 11:25:53 作者:
本篇文章是對(duì)android中的幫助、about、關(guān)于作者、HELP等提示頁(yè)面進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
在android中,經(jīng)常要用到幫助、about、關(guān)于作者等的提示頁(yè)面。
類似這樣的頁(yè)面:

這樣的頁(yè)面,我們可以通過(guò)AlertDialog對(duì)話框來(lái)設(shè)計(jì)。
設(shè)計(jì)一個(gè)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("超級(jí)笑話 v1.0.0" );
setView(view);
}
}
對(duì)應(yīng)的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>聯(lián)系:m.fzitv.net</i>
\n
\n
<b>超級(jí)笑話---收集了2000多各種類型的笑料,讓你全天笑不停!你還可以把笑話通過(guò)短信發(fā)給你的好友分享哦!</b>
\n
\n
<b>有任何建議或者反饋可以隨時(shí)聯(lián)系作者</b>
</string>
然后在頁(yè)面調(diào)用代碼即可顯示對(duì)話框
new AboutDialog(this).show();
類似這樣的頁(yè)面:

這樣的頁(yè)面,我們可以通過(guò)AlertDialog對(duì)話框來(lái)設(shè)計(jì)。
設(shè)計(jì)一個(gè)AboutDialog類繼承于AlertDialog
復(fù)制代碼 代碼如下:
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("超級(jí)笑話 v1.0.0" );
setView(view);
}
}
對(duì)應(yīng)的XML文件
1、layout布局文件about.xml
復(fù)制代碼 代碼如下:
<?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
復(fù)制代碼 代碼如下:
<string name="help_dialog_text">
<i>作者: 腳本之家</i>
\n
\n
<i>聯(lián)系:m.fzitv.net</i>
\n
\n
<b>超級(jí)笑話---收集了2000多各種類型的笑料,讓你全天笑不停!你還可以把笑話通過(guò)短信發(fā)給你的好友分享哦!</b>
\n
\n
<b>有任何建議或者反饋可以隨時(shí)聯(lián)系作者</b>
</string>
然后在頁(yè)面調(diào)用代碼即可顯示對(duì)話框
new AboutDialog(this).show();
您可能感興趣的文章:
- Android編程之界面跳動(dòng)提示動(dòng)畫效果實(shí)現(xiàn)方法
- Android模擬美團(tuán)客戶端進(jìn)度提示框
- Android里實(shí)現(xiàn)退出主程序的提示代碼
- android 彈出提示框的使用(圖文實(shí)例)
- android開發(fā)之蜂鳴提示音和震動(dòng)提示的實(shí)現(xiàn)原理與參考代碼
- Android編程實(shí)現(xiàn)監(jiān)聽EditText變化的方法
- Android編程中EditText限制文字輸入的方法
- Android編程開發(fā)之EditText中不輸入特定字符會(huì)顯示相關(guān)提示信息的方法
相關(guān)文章
Android 自定義view實(shí)現(xiàn)TopBar效果
這篇文章主要為大家詳細(xì)介紹了Android 自定義view實(shí)現(xiàn)TopBar效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-09-09
實(shí)例講解Android多線程應(yīng)用開發(fā)中Handler的使用
這篇文章主要介紹了Android多線程應(yīng)用開發(fā)中Handler的使用,Handle主要被用來(lái)更新UI和處理消息,需要的朋友可以參考下2016-01-01
Android14原生PackageInstaller安裝某些apk報(bào)錯(cuò)問(wèn)題
本文主要介紹了在Android 14上安裝大型應(yīng)用時(shí)遇到的java.lang.RuntimeException: Could not copy bitmap to parcel blob錯(cuò)誤,下面就一起來(lái)介紹一下解決方法,感興趣的可以了解一下2025-03-03
Android的TextView與Html相結(jié)合的具體方法
Android的TextView與Html相結(jié)合的具體方法,需要的朋友可以參考一下2013-06-06
Android三方依賴沖突Gradle中exclude的使用
這篇文章主要介紹了Android三方依賴沖突Gradle中exclude的使用,文章圍繞主題展開詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值,需要的小伙伴可以參考一下2022-09-09

