gyf-dev / gyf-dev/ImmersionBar

dialogFragment导致的下层状态栏无法隐藏

Open
#460 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
11.5k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

UI:在Activity隐藏状态栏和导航栏,然后显示一个dialogfragment(也隐藏状态栏和导航栏)
结果:状态栏和导航栏隐藏了 但是会显示个占位矩形(如果状态栏和导航栏有颜色)
代码:
activity:

    @Override
    protected void initImmersionBar() {
        super.initImmersionBar();
        ImmersionBar.with(this)
                .fitsSystemWindows(true)
                .navigationBarColor(R.color.btn3)
                .statusBarColor(R.color.btn3).init();
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        Integer[] widthAndHeight = Utils.getWidthAndHeight(getWindow());
        if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE){
            ImmersionBar.with(this)
                    .fitsSystemWindows(false)
                    .navigationBarColor(R.color.btn3)
                    .statusBarColor(R.color.btn3)
                    .hideBar(BarHide.FLAG_HIDE_BAR)
                    .init();
        }else{
            ImmersionBar.with(this)
                    .fitsSystemWindows(true)
                    .navigationBarColor(R.color.btn3)
                    .statusBarColor(R.color.btn3)
                    .hideBar(BarHide.FLAG_SHOW_BAR)
                    .init();
        }
}

dialogfragment:

@Override
    protected void initImmersionBar() {
        super.initImmersionBar();
        ImmersionBar.with(this)
                .hideBar(BarHide.FLAG_HIDE_BAR)
                .init();
    }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Activity and DialogFragment flow using the initImmersionBar configurations shown in the issue, including orientation changes and hidden system bars. Trace how the Activity and DialogFragment apply fitsSystemWindows, bar colors, and FLAG_HIDE_BAR; done means both bars are hidden without the colored placeholder rectangle.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.