Android default theme

前端 未结 3 980
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-12 21:53

I am making one android application but i was thinking about themes..

If i don\'t declare a theme of my Android application which theme will be used? Where i can find t

3条回答
  •  北海茫月
    2021-02-12 21:57

    The default theme for App is implement in Resources.java!

        /**
     * Returns the most appropriate default theme for the specified target SDK version.
     * 
      *
    • Below API 11: Gingerbread *
    • APIs 11 thru 14: Holo *
    • APIs 14 thru XX: Device default dark *
    • API XX and above: Device default light with dark action bar *
    * * @param curTheme The current theme, or 0 if not specified. * @param targetSdkVersion The target SDK version. * @return A theme resource identifier * @hide */ public static int selectDefaultTheme(int curTheme, int targetSdkVersion) { return selectSystemTheme(curTheme, targetSdkVersion, com.android.internal.R.style.Theme, com.android.internal.R.style.Theme_Holo, com.android.internal.R.style.Theme_DeviceDefault, com.android.internal.R.style.Theme_DeviceDefault_Light_DarkActionBar); } /** @hide */ public static int selectSystemTheme(int curTheme, int targetSdkVersion, int orig, int holo, int dark, int deviceDefault) { if (curTheme != 0) { return curTheme; } if (targetSdkVersion < Build.VERSION_CODES.HONEYCOMB) { return orig; } if (targetSdkVersion < Build.VERSION_CODES.ICE_CREAM_SANDWICH) { return holo; } if (targetSdkVersion < Build.VERSION_CODES.CUR_DEVELOPMENT) { return dark; } return deviceDefault; }

    It varies depending on the API level, so you'd better to define your own AppTheme in AndroidManifest.xml to assure Theme in all API level devices.

    Pls refer previous answer.

提交回复
热议问题