fragment+RadioGroup实现底部导航栏 多个 fragment 重影问题

fragment+RadioGroup实现底部导航栏

多个 fragment 重影问题

需要在fragment加上这行代码

    @Override
    public void setMenuVisibility(boolean menuVisible) {
        super.setMenuVisibility(menuVisible);
        if (this.getView() != null)
            this.getView().setVisibility(menuVisible ? View.VISIBLE : View.GONE);
    }

super.onSaveInstanceState(outState);这个需要删除掉

@Override
    protected void onSaveInstanceState(Bundle outState) {
        outState.putInt(savedTab, mainRadios.getCheckedRadioButtonId());
        RadioButton radioButton = (RadioButton) findViewById(mainRadios.getCheckedRadioButtonId());

        Log.i(Log_FILTER, (radioButton.getText() + ""));
        Log.i(Log_FILTER, "in main onSaveInstanceState");
        //删除下面这行,不然容易发生重影
// super.onSaveInstanceState(outState);
    }

你可能感兴趣的:(代码,Fragment,RadioGroup,底部导航栏,重影)