renaudcerrato / FloatingSearchView

Yet another floating search view implementation, also known as persistent search.
Apache License 2.0
1.33k stars 161 forks source link

MenuItems disappear when using FSV in a fragment #25

Closed vicvancooten closed 7 years ago

vicvancooten commented 7 years ago

FSV is the centerpiece of my application, mostly due to the way it handles icons beautifully. However, once I moved FSV into a fragment, instead of an activity, the icons stopped showing up as in the demo, and started showing up like regular android menus.

This is what it looks like with the menu from the sample: image image

Here's the widget as defined in my Fragment's XML:

    <com.mypopsy.widget.FloatingSearchView
        android:id="@+id/uiSearch"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginLeft="35dp"
        android:layout_marginRight="35dp"
        android:layout_marginTop="150dp"
        android:background="#90000000"
        android:hint="@string/search"
        android:translationZ="12dp"
        app:fsv_contentBackgroundColor="@color/white"
        app:fsv_cornerRadius="5dp"
        app:fsv_menu="@menu/search"
        tools:context=".MainActivity"/>

The menu items work when clicked on. The MenuProgressBar class doesn't show at all.

This may be a theming issue or unrelated to fragments. I'm not exactly sure.

I don't think it's relevant info, but I'm using Kotlin and Android Studio 3.

vicvancooten commented 7 years ago

After some time, I figured out FSV is just not compatible with all activities. It IS compatible with AppCompatActivity, but not with FragmentActivity.