0

I read a half-dozen of threads(particularly this one, who share the issue) about actionBar height, but it seems to no one already get this issue : My actionBar has an unmodifiable blank(bg color) area under itself :

action bar white area

The custom action bar is defined like this :

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityValveassemblyBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        mContentView = binding.fullscreenContent;
        mContentView.getWindowInsetsController().setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
        mContentView.getWindowInsetsController().hide(WindowInsets.Type.navigationBars()); // HIDE ANDROID UI

        // ACTIONBAR
        ActionBar actionBar = getSupportActionBar(); // define actionBar
        assert actionBar != null;
        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); // allow custom
        actionBar.setCustomView(R.layout.actionbar_layout); // define custom

As screen said,

        <item name="actionBarSize">48dp</item>
        <item name="android:windowActionBarOverlay">true</item>

is defined. windowActionBarOverlay = false is the same result.

I can't find what is this area's name, or how to delete it. I can't use these 8 pixels, and until now I only had white bg activites, but I have to use grey background and this line is bothering me so hard.

Edit : and, according to the Layout inspector, this area is... nothing.

gif

Edit2 : with default actionBar and Empty activity :

img

Edit3 : Add customAction bar layout

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="38dp"
    android:orientation="horizontal"
    android:id="@+id/actionbarlinearlayout">
    <ImageButton
        android:id="@+id/TopLeft"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:contentDescription="@string/settings"
        android:src="@drawable/ic_back"
        android:background="#00000000"
        android:onClick="topLeftButton"
        />
    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center">
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginStart="50dp"
                android:contentDescription="@string/shift"
                android:src="@drawable/ic_shift" />
            <TextView
                android:id="@+id/Shift"
                android:layout_width="wrap_content"
                android:layout_height="48dp"
                android:layout_marginStart="70dp"
                android:layout_marginTop="-17dp"
                android:fontFamily="@font/fontnats"
                android:text="@string/Morningshift"
                android:textColor="@color/black"
                android:textSize="30sp"
                />
            <ImageButton
                android:id="@+id/ShiftReload"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="172dp"
                android:background="#00FFFFFF"
                android:onClick="shiftReload"
                android:padding="5.5dp"
                android:src="@drawable/ic_reload" />
    </RelativeLayout>
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginStart="10dp"
        android:layout_gravity="center"
        android:contentDescription="@string/app_name"
        android:src="@drawable/ic_logo_bic" />
Phaeron
  • 33
  • 6
  • 1
    Sorry, I can't understand your question properly. Because you have not added in your question that what do you want to do with these blank spaces? Do you want to remove the bottom `8dp` white area? or want to change its color from white to another? and or want to fill these with your Custom `ActionBar`? I'll update my answer with a solution. – M DEV Apr 16 '22 at 09:38
  • Sorry, It was clear for me. I want to remove this 8dp white area, so that the Activity Layout begin 8dp higher. Actuelly, I can't do anything with this area, and as we see at the first top screen, if I add a color on my Activity Layout, a white useless strip stay. Is it clearer ? – Phaeron Apr 16 '22 at 09:58
  • 1
    can I see your `Custom ActionBar` layout(XML) file? Add layout also in your question. – M DEV Apr 16 '22 at 10:01
  • Sure, Added. But as you can see on my edit2, It's the same issue with default ActionBar, as if Android refuses to get ActionBar smaller than 56dp – Phaeron Apr 16 '22 at 10:04
  • can I know why you added your LinearLayout height `android:layout_height="38dp"`. it is your custom `ActionBar` height? – M DEV Apr 16 '22 at 10:08
  • I tried few thing, At the beginning it was wrap_content, but Yes it's the custom `Actionbar` height – Phaeron Apr 16 '22 at 10:09
  • Ok, just remove `android:layout_height="38dp"` and add `android:layout_height="?actionBarSize"` and let me know your problem is solved or not? – M DEV Apr 16 '22 at 10:12

0 Answers0