I have a fragment that is contained in a fragment container in an активити . But besides the container, the активити also has a тулбар on top. The bottom line is that in this way I cannot move the elements above the container, since there still stands a тулбар , so when I turn to the fragment in which the method is called mainActivity.getSupportActionBar().hide(); , which hides the тулбар , I have an empty space on top, which cannot be filled in any way. The question is how can the element be moved up (in this case, the inscription Parepan)

What it looks like in the AS markup How it looks in the markup in AS

How it looks on a real device How it looks on a real device

Activation Markup

 <?xml version="1.0" encoding="utf-8"?> 

 <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/fragmentContainer" tools:layout="@layout/welcome_fragment" android:layout_marginTop="?android:actionBarSize" /> <include android:layout_width="fill_parent" android:layout_height="wrap_content" layout="@layout/toolbar" android:layout_gravity="center_horizontal|top" /> 

    1 answer 1

    Use a NoActionBar theme for Activity , for example Theme.AppCompat.Light.NoActionBar . On the preview you have this theme and is used.

    • Can you please specific code. android: theme = "@ android: style / Theme.AppCompat.Light.NoActionBar - for some reason this doesn't work - timuruktus