Answer the question
In order to leave comments, you need to log in
How to make a fragment not take up the whole screen?
Here is the markup of the main activity in it a fragment and a bottom menu
<RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container"
android:background="@color/backgroudMainActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.egor.xcryptex.MainActivity">
>
<RelativeLayout
android:id="@+id/contentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottom_navigation">
</RelativeLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:itemBackground="@color/backgroundLayoutMenu"
app:itemIconTint="@drawable/collors_buttom_menu"
app:itemTextColor="@color/white"
app:menu="@menu/botton_menu_navigation"
/>
</RelativeLayout>
<RelativeLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black_color"
tools:context="com.example.egor.xcryptex.fragments.FragmentPurse">
</RelativeLayout>
fragmentManager.beginTransaction().replace(R.id.container,fragmentPurse,TAG_4).commit()
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_fragment_purse, container, false);
}
Answer the question
In order to leave comments, you need to log in
you specify the wrong id in
fragmentManager.beginTransaction().replace(R.id.container,fragmentPurse,TAG_4).commit()
you need
@+id/contentContainer
the size of your container is "full screen", in the fragment you also specify "full screen" - everything works as you specified
android:layout_width="wrap_content" specify in the fragment and throw a TextView there, otherwise you will not see
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question