arimorty / floatingsearchview

A search view that implements a floating search bar also known as persistent search
https://github.com/arimorty/floatingsearchview/blob/master/README.md
Apache License 2.0
3.54k stars 667 forks source link

Menu items are always in the overflow button #83

Closed benoffi7 closed 8 years ago

benoffi7 commented 8 years ago

Hi! I Have this menu.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto">

    <item android:id="@+id/action_send"
        android:title="Pedido"
        android:icon="@drawable/carrito_white"
        android:orderInCategory="1"
        app:showAsAction="always" />

    <item android:id="@+id/action_pedido"
        android:title="Mesa"
        android:orderInCategory="1"
        android:icon="@drawable/pedido_white"
        app:showAsAction="always" />

    <item android:id="@+id/action_user"
        android:title="User"
        android:orderInCategory="1"
        android:icon="@drawable/user_white"
        app:showAsAction="always" />

</menu>

and this sreachview

 <com.arlib.floatingsearchview.FloatingSearchView
            android:id="@+id/floating_search_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:floatingSearch_dismissOnOutsideTouch="true"
            app:floatingSearch_leftActionMode="showHome"
            app:floatingSearch_searchBarMarginLeft="@dimen/search_view_inset"
            app:floatingSearch_searchBarMarginRight="@dimen/search_view_inset"
            app:floatingSearch_searchBarMarginTop="@dimen/search_view_inset"
            app:floatingSearch_searchHint="Search..."
            app:floatingSearch_showSearchKey="true"
            app:floatingSearch_suggestionsListAnimDuration="250"
            app:floatingSearch_backgroundColor="@color/white"
            app:floatingSearch_menu="@menu/menu_carrito"
            app:floatingSearch_dimBackground="true"/>

device-2016-07-01-225620 device-2016-07-01-225637

The same menu in different activities

Thanks!

benoffi7 commented 8 years ago

layout-2016-07-02-073553

This is a screenshot of my Android Studio design XML...

benoffi7 commented 8 years ago

The sample app has the same problem. In the design view, the menu appears but when I run the app, the menu is in the overflow item.

arimorty commented 8 years ago

Hi @benoffi7 ,

What you are experiencing is because the width the library allocates for the action items is different from the standard action bar. This is bad, and I fixed it (it will be in the next release, but you can try it now by downloading the 2.0.2 branch)

Thanks for opening this issue! it is a very important contribution to the library, Ari