Cross to clear search box overlaps overflow menu in Android 6

37 views
Skip to first unread message

Chris Thompson

unread,
Jul 2, 2016, 11:10:19 AM7/2/16
to ActionBarSherlock
As shown in the attached image, in Android 6, the cross to clear the search bar is overlapping with the overflow menu.

In Android versions 5 and below, the overflow menu correctly displays alongside the cross.

This looks like a similar issue to the one described on this thread:


I tried changing android:showAsAction="always" to android:showAsAction="collapseActionView|ifRoom" as mentioned in that thread, but then the search box disappeared completely.

The XML for my search activity is here:

<?xml version="1.0" encoding="utf-8"?>
    <item android:id="@+id/search"
          android:showAsAction="always"
          android:title="@string/search"          
          android:actionViewClass="com.actionbarsherlock.widget.SearchView" />
    <item android:id="@+id/user_language"
          android:showAsAction="never"
          android:title="@string/user_language" />
    <item android:id="@+id/rate_app"
          android:showAsAction="never"
          android:title="@string/rate_app" />
    <item android:id="@+id/send_feedback"
          android:showAsAction="never"
          android:title="@string/send_feedback" />
    <item android:id="@+id/about"
          android:showAsAction="never"
          android:title="@string/about" />
</menu>

My SearchActivity.java code is also attached.

In my build.gradle:

    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'

Any suggestions how I can fix this?

Chris
layout bug screenshot.png
SearchActivity.java

Chris Thompson

unread,
Jul 4, 2016, 10:09:49 AM7/4/16
to ActionBarSherlock
The specific Android version was 6.0.1. The device tested was a Galaxy S6 phone.
Reply all
Reply to author
Forward
0 new messages