关于造型对话

时间:2013-03-01 14:43:35

标签: android dialog customization

对于我的自定义对话框,我使用parent="@android:style/Theme.Dialog"。源代码Theme.Holo.Dialog(API 11)

<style name="Theme.Holo.Dialog">
    <item name="android:windowFrame">@null</item>
    <item name="android:windowTitleStyle">@android:style/DialogWindowTitle.Holo</item>
    <item name="android:windowBackground">@android:drawable/dialog_full_holo_dark</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowAnimationStyle">@android:style/Animation.Holo.Dialog</item>
    <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
    <item name="android:windowActionBar">false</item>
    <item name="android:windowActionModeOverlay">true</item>
    <item name="android:windowCloseOnTouchOutside">@bool/config_closeDialogWhenTouchOutside</item>

    <item name="android:colorBackgroundCacheHint">@null</item>

    <item name="android:buttonBarStyle">@android:style/Holo.ButtonBar.AlertDialog</item>
    <item name="borderlessButtonStyle">@android:style/Widget.Holo.Button.Borderless.Small</item>

    <item name="textAppearance">@android:style/TextAppearance.Holo</item>
    <item name="textAppearanceInverse">@android:style/TextAppearance.Holo.Inverse</item>

    <item name="listPreferredItemPaddingLeft">16dip</item>
    <item name="listPreferredItemPaddingRight">16dip</item>
</style>

如何在android 2.2(API 8)中设置<item name="android:windowCloseOnTouchOutside">false</item>

1 个答案:

答案 0 :(得分:0)

您可以使用setCanceledOnTouchOutside()从API v1开始在代码中设置此项。