0
1

Android SDK 35 (Android 15) で setStatusBarColor などがdepreceted関連のメモ

Posted at

Android 15 で setStatusBarColor が deprecated (かつもはや機能しない) Javadoc確認

setNavigationBarColor and R.attr#navigationBarColor are deprecated and don't affect gesture navigation.

Behavior changes: Apps targeting Android 15 or higher  |  Android Developers
https://developer.android.com/about/versions/15/behavior-changes-15

ではあるが、Javadocの差分を毎回確認するのが面倒なのでメモです.

Window#setStatusBarColor(int)

Window  |  Android Developers
https://developer.android.com/reference/android/view/Window#setStatusBarColor(int)

Android SDK 34 (Android 14)

    /**
     * Sets the color of the status bar to {@code color}.
     *
     * For this to take effect,
     * the window must be drawing the system bar backgrounds with
     * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} and
     * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_STATUS} must not be set.
     *
     * If {@code color} is not opaque, consider setting
     * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
     * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.
     * <p>
     * The transitionName for the view background will be "android:status:background".
     * </p>
     */
    public abstract void setStatusBarColor(@ColorInt int color);

Android SDK 35 (Android 15)

    /**
     * Sets the color of the status bar to {@code color}.
     *
     * For this to take effect,
     * the window must be drawing the system bar backgrounds with
     * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} and
     * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_STATUS} must not be set.
     *
     * If {@code color} is not opaque, consider setting
     * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
     * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.
     * <p>
     * The transitionName for the view background will be "android:status:background".
     *
     * <p>
     * If the color is transparent and the window enforces the status bar contrast, the system
     * will determine whether a scrim is necessary and draw one on behalf of the app to ensure
     * that the status bar has enough contrast with the contents of this app, and set an appropriate
     * effective bar background accordingly.
     *
     * <p>
     * If the app targets
     * {@link android.os.Build.VERSION_CODES#VANILLA_ICE_CREAM VANILLA_ICE_CREAM} or above,
     * the color will be transparent and cannot be changed.
     *
     * @see #setNavigationBarContrastEnforced
     * @deprecated Draw proper background behind {@link WindowInsets.Type#statusBars()}} instead.
     */
    @Deprecated
    public abstract void setStatusBarColor(@ColorInt int color);
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1