从一个活动中按下一个按钮启动一个片段。显示了这个片段,但也显示了女巫的活动内容。我希望那个片段不透明。
launchFragmentButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
FragmentManager manager = getSupportFragmentManager();
DisplayFragment fragmentDisplay = new DisplayFragment();
FragmentTransaction fragmentTransaction = manager.beginTransaction();
fragmentTransaction.replace(R.id.display_container, fragmentDisplay);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}
});
答案 0 :(得分:0)
将背景设置为父节点。像这样
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
<!-- set here your background -->
android:background="@color/main_bg"
tools:context="fragmentsMain.HomeFragment">
</RelativeLayout >