Сэндвич с мороженым:
Я хочу добавить AutoCompleteTextView в ActionBar через стандартный механизм Action View (поскольку SearchView недоступен до ICS, и я также использую ActionBarSherlock)
<item android:id="@+id/menu_search" android:actionViewClass="com.example.AutoCompleteActionView" android:showAsAction="ifRoom" android:title="@string/address"></item>
<item android:id="@+id/menu_close" android:icon="@drawable/ic_menu_close_clear_cancel" android:showAsAction="always"></item>
<item android:id="@+id/menu_ok" android:icon="@drawable/ic_menu_ok" android:showAsAction="always"></item>
Это работает, однако по умолчанию он не использует доступное пространство в ActionBar, которое мне бы хотелось.
Я посмотрел источник для SearchView и увидел, как он переопределяет onMeasure, и сделал то же самое для моего собственного класса, который я получил из AutoCompleteTextView. Когда я это делаю, AutoCompleteTextView потребляет все пространство, не оставляя места для двух элементов меню, которые я хочу отображать справа от него.
Похоже, что ширина, возвращаемая из MeasureSpec.getSize(), не учитывает два других пункта меню, когда MeasureSpec.getMode() MeasureSpec.AT_MOST.
Кто-нибудь сделал что-нибудь подобное? Любые предложения?
Спасибо, Damian