溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Android自定義個性化的Dialog示例

發(fā)布時間:2020-10-18 05:36:18 來源:腳本之家 閱讀:99 作者:Jacob-wj 欄目:移動開發(fā)

本文實例講述了Android自定義個性化的Dialog。分享給大家供大家參考,具體如下:

Dialog:

mDialog = new Dialog(this, R.style.chooseUserDialogTheme);
mDialog.setTitle(R.string.choose_user);
View rootView = LayoutInflater.from(this).inflate(
    R.layout.view_simple_choose_user, null);
mDialog.setContentView(rootView);
mLinearLayoutUserList = (LinearLayout) rootView
    .findViewById(R.id.linearLayout_user_list);
mDialog.show();
mIsUserListShown = true;
DialogInterface.OnDismissListener listener = new DialogInterface.OnDismissListener() {
  @Override
  public void onDismiss(DialogInterface dialog) {
    timer.cancel();
    mIsUserListShown = false;
  }
};
mDialog.setOnDismissListener(listener);

R.style.chooseUserDialog

<style name="chooseUserDialogTheme" parent="@android:style/Theme.Dialog">
    <item name="android:background">@android:color/transparent</item>
    <item name="android:textAppearance">@style/textAppearanceL</item>
    <item name="android:textColor">@android:color/white</item>
    <item name="android:windowBackground">@drawable/bg_choose_user_simple</item>
    <item name="android:popupBackground">@drawable/bg_main_activity_top_bar</item>
</style>

R.layout.view_simple_choose_user

<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@drawable/bg_main_activity_top_bar"
  android:orientation="vertical" >
  <LinearLayout
    android:id="@+id/linearLayout_user_list"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >
  </LinearLayout>
</HorizontalScrollView>

更多關于Android相關內容感興趣的讀者可查看本站專題:《Android開發(fā)入門與進階教程》、《Android調試技巧與常見問題解決方法匯總》、《Android多媒體操作技巧匯總(音頻,視頻,錄音等)》、《Android基本組件用法總結》、《Android視圖View技巧總結》、《Android布局layout技巧總結》及《Android控件用法總結》

希望本文所述對大家Android程序設計有所幫助。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。

AI