Fix for search view/IME issues
- Set the search view as the custom action bar view on tablet too,
(not as an acition view of a menu item.)
- Add a dummy view to the action bar to prevent the search view from
getting the initial focus.
- Call SearchView.setIconified(false) to make sure the IME will pop up
when setting focus on the search view.
Fix for:
- tablet: Keyboard keeps popping up upon app launch.
- tablet: Keyboard keeps going away after each character is typed.
- tablet: Have the search view request focus again.
- phone: Keyboard won't pop up when the search view is shown
Note:
- The width of the search view on the tablet is temporary until we
get redlines.
Bug 4691469
Change-Id: I70d1dddebf63120e8fbbafd6a0548d8553a8927c
diff --git a/res/layout/custom_action_bar.xml b/res/layout/custom_action_bar.xml
index 2357756..f749586 100644
--- a/res/layout/custom_action_bar.xml
+++ b/res/layout/custom_action_bar.xml
@@ -14,11 +14,20 @@
limitations under the License.
-->
+<!-- Dimensions are set at runtime in ActionBarAdapter -->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
+ android:layout_width="0dip"
+ android:layout_height="0dip" >
+ <!-- To prevent the search view from getting the initial focus. -->
+ <View
+ android:focusable="true"
+ android:focusableInTouchMode="true"
+ android:layout_width="1px"
+ android:layout_height="1px" >
+ <requestFocus />
+ </View>
<SearchView
android:id="@+id/search_view"
android:layout_width="match_parent"