Search code examples
androidandroid-layoutwindowandroid-source

Can't find source of TYPE_SYSTEM_ALERT


For a project I want to create my own window style. I mean something like this:

<style name="MyFloatingWindow">
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:background">@android:color/transparent</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:windowNoTitle">true</item>
</style>

To get some ideas how I can implement my ideas I want to look into the style source of andriod but I can't find it. What is the original style of WindowManager.LayoutParams.TYPE_SYSTEM_ALERT?

Or is it possible to create a new layout style with TYPE_SYSTEM_ALERT as parent? What do I have to write as parent?

<style name="MyOverlay" parent="android:***">

</style>

Solution

  • The TYPE_SYSTEM_ALERT simply means that the windows are always on top of application windows. In multiuser systems shows only on the owning user's window. It has nothing to do with the any style of your window or how the window will look like.

    There are a lot of pre-defined styles in styles.xml under frameworks\base\core\res\res\values. For example the AlertDialog.

    <style name="AlertDialog">
        <item name="fullDark">@android:drawable/popup_full_dark</item>
        <item name="topDark">@android:drawable/popup_top_dark</item>
        <item name="centerDark">@android:drawable/popup_center_dark</item>
        <item name="bottomDark">@android:drawable/popup_bottom_dark</item>
        <item name="fullBright">@android:drawable/popup_full_bright</item>
        <item name="topBright">@android:drawable/popup_top_bright</item>
        <item name="centerBright">@android:drawable/popup_center_bright</item>
        <item name="bottomBright">@android:drawable/popup_bottom_bright</item>
        <item name="bottomMedium">@android:drawable/popup_bottom_medium</item>
        <item name="centerMedium">@android:drawable/popup_center_medium</item>
        <item name="progressLayout">@android:layout/progress_dialog</item>
        <item name="horizontalProgressLayout">@android:layout/alert_dialog_progress</item>
    </style>