我试图使我的XXX和我的YYY透明,但发生了什么,是他们有一个灰色的背景颜色,我不知道从哪里来的。下面是一个图像如何你和我的代码:link to the printscreen of the statubar
主页活动.java
public class HomeActivity extends BaseActivity implements HomeMVPView {
@BindView(R.id.my_toolbar)
Toolbar toolbar;
private DataManager dm;
private HomePresenter presenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
ButterKnife.bind(this);
Window w = getWindow();
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
toolbar.setTitle("");
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
inicializeBottomNav();
}
private void inicializeBottomNav() {
bottomNavigationView.setOnNavigationItemSelectedListener(item -> {
Fragment selectedFragment = null;
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
switch (item.getItemId()) {
case R.id.navigation_home_dashboard:
selectedFragment = DashboardHomeFragment.newInstance("DashboardHomeFragment");
break;
case R.id.navigation_trips:
selectedFragment = TripsHomeFragment.newInstance("TripsHomeFragment");
break;
}
if (selectedFragment == null) selectedFragment = DashboardHomeFragment.newInstance("ProfileFragment");
transaction.replace(R.id.frame_layout, selectedFragment);
transaction.commit();
return true;
});
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.frame_layout, DashboardHomeFragment.newInstance("DashboardHomeFragment"));
transaction.commit();
BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
}
}
** Jmeter 板主页片段.java**
public class DashboardHomeFragment extends BaseFragment implements DashboardHomeFragmentMvpView {
// methods
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_dashboard_home, container, false);
ButterKnife.bind(this, view);
ViewUtils.setStatusBarTranslucent(getBaseActivity(), true);
return view;
}
}
**
样式.xml
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
分段 Jmeter 板主目录.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="match_parent">
<!-- ... -->
</FrameLayout>
1条答案
按热度按时间a9wyjsp71#
将此添加到您的应用程序主题中: