Merge "Fix search styling."

This commit is contained in:
Ben Komalo 2011-08-09 18:07:00 -07:00 committed by Android (Google) Code Review
commit 2468b54db5
6 changed files with 15 additions and 34 deletions

View File

@ -22,8 +22,7 @@
<FrameLayout <FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dip" style="@style/action_bar_custom_view"
android:layout_height="0dip"
> >
<include <include
android:id="@+id/account_spinner_container" android:id="@+id/account_spinner_container"

View File

@ -14,16 +14,11 @@
limitations under the License. limitations under the License.
--> -->
<FrameLayout <SearchView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/SearchBar"
android:orientation="horizontal"
>
<SearchView
android:id="@+id/search_view" android:id="@+id/search_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:iconifiedByDefault="false" android:iconifiedByDefault="true"
/> />
</FrameLayout>

View File

@ -16,7 +16,8 @@
<LinearLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/action_bar_spinner" android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" android:orientation="horizontal"
> >
<RelativeLayout <RelativeLayout

View File

@ -116,16 +116,11 @@
<item name="android:layout_alignParentRight">true</item> <item name="android:layout_alignParentRight">true</item>
</style> </style>
<style name="SearchBar"> <style name="action_bar_custom_view">
<item name="android:layout_width">420dip</item> <item name="android:layout_width">420dip</item>
<item name="android:layout_height">match_parent</item> <item name="android:layout_height">match_parent</item>
</style> </style>
<style name="action_bar_spinner">
<item name="android:layout_width">350dip</item>
<item name="android:layout_height">match_parent</item>
</style>
<style name="action_bar_spinner_primary_text"> <style name="action_bar_spinner_primary_text">
<item name="android:includeFontPadding">false</item> <item name="android:includeFontPadding">false</item>
<item name="android:textSize">18sp</item> <item name="android:textSize">18sp</item>

View File

@ -127,7 +127,7 @@
<item name="android:singleLine">true</item> <item name="android:singleLine">true</item>
</style> </style>
<style name="SearchBar"> <style name="action_bar_custom_view">
<item name="android:layout_width">match_parent</item> <item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item> <item name="android:layout_height">match_parent</item>
</style> </style>
@ -170,11 +170,6 @@
<item name="android:ellipsize">end</item> <item name="android:ellipsize">end</item>
</style> </style>
<style name="action_bar_spinner">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
</style>
<style name="action_bar_spinner_primary_text"> <style name="action_bar_spinner_primary_text">
<item name="android:textSize">16sp</item> <item name="android:textSize">16sp</item>
<item name="android:textColor">@color/text_primary_color</item> <item name="android:textColor">@color/text_primary_color</item>

View File

@ -206,13 +206,8 @@ public class ActionBarController {
mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM); mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM);
// Prepare the custom view // Prepare the custom view
final LayoutInflater inflater = LayoutInflater.from(mContext); mActionBar.setCustomView(R.layout.action_bar_custom_view);
mActionBarCustomView = (ViewGroup) inflater.inflate(R.layout.action_bar_custom_view, null); mActionBarCustomView = (ViewGroup) mActionBar.getCustomView();
final ActionBar.LayoutParams customViewLayout = new ActionBar.LayoutParams(
ActionBar.LayoutParams.WRAP_CONTENT,
ActionBar.LayoutParams.MATCH_PARENT);
customViewLayout.setMargins(0, 0, 0, 0);
mActionBar.setCustomView(mActionBarCustomView, customViewLayout);
// Account spinner // Account spinner
mAccountSpinnerContainer = mAccountSpinnerContainer =
@ -244,6 +239,7 @@ public class ActionBarController {
mSearchView = UiUtilities.getView(mSearchContainer, R.id.search_view); mSearchView = UiUtilities.getView(mSearchContainer, R.id.search_view);
mSearchView.setSubmitButtonEnabled(false); mSearchView.setSubmitButtonEnabled(false);
mSearchView.setOnQueryTextListener(mOnQueryText); mSearchView.setOnQueryTextListener(mOnQueryText);
mSearchView.onActionViewExpanded();
mActionBarCustomView.addView(mSearchContainer); mActionBarCustomView.addView(mSearchContainer);
} }
} }