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

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

這樣的頁面,我們可以通過AlertDialog對話框來設(shè)計。
設(shè)計一個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("超級笑話 v1.0.0" );
setView(view);
}
}
對應(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)系:www.dbjr.com.cn</i>
\n
\n
<b>超級笑話---收集了2000多各種類型的笑料,讓你全天笑不停!你還可以把笑話通過短信發(fā)給你的好友分享哦!</b>
\n
\n
<b>有任何建議或者反饋可以隨時聯(lián)系作者</b>
</string>
然后在頁面調(diào)用代碼即可顯示對話框
new AboutDialog(this).show();
相關(guān)文章
使用SharedPreferences在Android存儲對象詳細代碼
這篇文章主要介紹了使用SharedPreferences在Android存儲對象并附上詳細代碼,下面文章內(nèi)容較少,大多以代碼的形式體現(xiàn),需要的小伙伴可以參考一下,希望對你有所幫助2021-11-11總結(jié)Android App內(nèi)存優(yōu)化之圖片優(yōu)化
網(wǎng)上有很多大拿分享的關(guān)于Android性能優(yōu)化的文章,主要是通過各種工具分析,使用合理的技巧優(yōu)化APP的體驗,提升APP的流暢度,但關(guān)于內(nèi)存優(yōu)化的文章很少有看到。下面是我在實踐過程中使用的一些方法,很多都是不太成熟的項目,只是將其作為一種處理方式分享給大家。2016-08-08Android Studio之Debug運行期代碼植入的方法
這篇文章主要介紹了Android Studio之Debug運行期代碼植入的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-07-07Android 完全退出當(dāng)前應(yīng)用程序的四種方法
Android程序有很多Activity,比如說主窗口A,調(diào)用了子窗口B,如果在B中直接finish(), 接下里顯示的是A。在B中如何關(guān)閉整個Android應(yīng)用程序呢?本人總結(jié)了幾種比較簡單的實現(xiàn)方法2016-02-02Android開發(fā)之獲取SD卡及手機ROM容量的方法
這篇文章主要介紹了Android開發(fā)之獲取SD卡及手機ROM容量的方法,結(jié)合實例形式分析了Android針對SD卡的讀取及屬性操作相關(guān)技巧,需要的朋友可以參考下2016-04-04android實現(xiàn)在橫豎屏切換時頁面信息不被重置的示例分享
這篇文章主要介紹了android實現(xiàn)在橫豎屏切換時頁面信息不被重置的示例,需要的朋友可以參考下2014-02-02Android日期選擇器實現(xiàn)年月日三級聯(lián)動
這篇文章主要為大家詳細介紹了Android日期選擇器實現(xiàn)年月日三級聯(lián)動,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-01-01Android Content Provider詳解及示例代碼
本文主要講解Android Content Provider,這里提供相關(guān)文檔資料,并附有實現(xiàn)代碼和實現(xiàn)效果圖,有需要的小伙伴可以參考下2016-08-08