Obsolete
Status Update
Comments
sb...@google.com <sb...@google.com>
ro...@google.com <ro...@google.com>
cc...@gmail.com <cc...@gmail.com> #3
This is in fact an important problem for ActionBarCompat.
One cannot add any other action item when SearchView is included in always-expanded mode.
Having attribute app:showAsAction="always|collapseActionView" for searchView and calling MenuItem.expandActionView() in code as a workaround doesn't really have the same effect.
Please review its priority.
Forcing the user to use SearchView with 2 taps decreases the quality of user experience on our part.
One cannot add any other action item when SearchView is included in always-expanded mode.
Having attribute app:showAsAction="always|collapseActionView" for searchView and calling MenuItem.expandActionView() in code as a workaround doesn't really have the same effect.
Please review its priority.
Forcing the user to use SearchView with 2 taps decreases the quality of user experience on our part.
fe...@gmail.com <fe...@gmail.com> #4
I agree with #4.
cc...@gmail.com <cc...@gmail.com> #5
[Comment deleted]
cc...@gmail.com <cc...@gmail.com> #6
[Comment deleted]
cc...@gmail.com <cc...@gmail.com> #7
Additional information that can be useful:
The issue only happens when SearchView is included in ActionBar menu.xml and setIconifiedByDefault(false) is applied.
SearchView item definition from menu.xml:
<item android:id="@+id/menuSearch"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="always"
android:title="Search">
</item>
Including SearchView as custom view works correctly, like in this scenario:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SearchView searchView = new SearchView(this);
searchView.setIconifiedByDefault(false);
getActionBar().setCustomView(searchView);
getActionBar().setDisplayShowCustomEnabled(true);
}
The issue only happens when SearchView is included in ActionBar menu.xml and setIconifiedByDefault(false) is applied.
SearchView item definition from menu.xml:
<item android:id="@+id/menuSearch"
app:actionViewClass="android.support.v7.widget.SearchView"
app:showAsAction="always"
android:title="Search">
</item>
Including SearchView as custom view works correctly, like in this scenario:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SearchView searchView = new SearchView(this);
searchView.setIconifiedByDefault(false);
getActionBar().setCustomView(searchView);
getActionBar().setDisplayShowCustomEnabled(true);
}
he...@gmail.com <he...@gmail.com> #8
It's the same for ActionBar not only ActionBarCompat.
[Deleted User] <[Deleted User]> #9
Ditto this is an ugly bug. It prevents this use case:
- search is done via a REST API whenever someone types a character in
- search takes a while to happen so we should display a progress indicator to user so they don't kill the app because it's not responsive
2nd step is impossible :-(
- search is done via a REST API whenever someone types a character in
- search takes a while to happen so we should display a progress indicator to user so they don't kill the app because it's not responsive
2nd step is impossible :-(
Description
I'm using basically the same code I was using with the ActionBarSherlock. I just made some adjustments to use the ActionBarCompat. With the ActionBarSherlock, the SearchView reduces its width when needed. With the ActionBarCompat, it doesn't happen.
I've posted in the StackOverflow with more details (with screenshots and some example code):