Search code examples
androidandroid-actionbaractionbarsherlockandroid-holo-everywhere

ActionBarSherlock + HoloEverywhere + SlidingMenu EditText issue


I have been messing around lately with these amazing libraries: ActionBarSherlock, HoloEverywhere and SlidingMenu.

Then I stumbled upon this weird issue: When I add an EditText inside a View, HoloEverywhere theming is working fine. But when I add an EditText to ActionBarSherlock, HoloEverywhere theming is not overriding the default theme.

This is how I am adding the EditText to ActionBarSherlock:

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content">

    <EditText 
    android:id="@+id/collapsibleEditText" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:hint="@string/widget_searchview_title" 
    android:imeOptions="actionSearch" 
    android:inputType="text" android:paddingRight="35dip" />

    <Button 
    android:id="@+id/clearButton" 
    android:layout_width="30dip" 
    android:layout_height="30dip" 
    android:layout_alignParentRight="true" 
    android:layout_centerVertical="true" 
    android:layout_marginRight="5dip" 
    android:background="@drawable/navigation_cancel" />

</RelativeLayout>

and

menu.add("Search")
.setIcon(R.drawable.ic_action_search)
.setActionView(R.layout.collapsible_edittext)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | 
    MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);

This is how it looks like running on a simulator (as I don't have a pre-honeycomb device handy) : demo

Is this a known issue? I am sure that I messed things up in my implementation. Can anyone guide me through this issue? Thanks.


Solution

  • In the end I decided that HoloEverywhere was too heavy for my application, and decided to include and apply manually the Styles that I needed to use, which solved the issue I was having.

    This solution was based on this SO post: https://stackoverflow.com/a/10903421/690917