Android自定义Dialog Android自定义个性化的Dialog示例
Jacob-wj 人气:0想了解Android自定义个性化的Dialog示例的相关内容吗,Jacob-wj在本文为您仔细讲解Android自定义Dialog的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:Android,自定义,Dialog,下面大家一起来学习吧。
本文实例讲述了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程序设计有所帮助。
加载全部内容