0

I have an Appbarlayout like this in my app:

<android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:background="#33000000"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <android.support.v7.widget.Toolbar
            android:id="@+id/toolBar"
            app:titleTextColor="@color/light_blue"
            android:title="@{viewModel.title}"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="enterAlways" />
        <SearchView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/searchView"
            android:queryBackground="@android:color/transparent"
            android:searchHintIcon="@drawable/ic_search"
            app:searchIcon="@drawable/ic_search"
            android:iconifiedByDefault="false"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            app:defaultQueryHint="Search"
            android:queryHint="Search" />
    </android.support.design.widget.AppBarLayout>

This works fine on API23 devices, but on API24 devices, "wrap_content" hides the searchview and only the Toolbar shows up...

If I do this:

<android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:background="#33000000"
        android:layout_width="match_parent"
        android:layout_height="150dp">

Both shows up just fine.

What is happening here? Is this a bug?

Here it is in an API24 emulator:

enter image description here

And in an API23 emulator, same code:

enter image description here

breakline
  • 5,776
  • 8
  • 45
  • 84

0 Answers0