Extends the width of the search view.

This commit is contained in:
Vavassor 2017-06-22 02:00:03 -04:00
parent 9b0977cff0
commit 727d262e55
4 changed files with 15 additions and 2 deletions

View File

@ -89,7 +89,8 @@ public class SearchActivity extends BaseActivity implements SearchView.OnQueryTe
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.search_toolbar, menu);
SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
SearchView searchView = (SearchView) menu.findItem(R.id.action_search)
.getActionView();
setupSearchView(searchView);
if (currentQuery != null) {
@ -160,6 +161,8 @@ public class SearchActivity extends BaseActivity implements SearchView.OnQueryTe
searchView.setOnQueryTextListener(this);
searchView.setFocusable(false);
searchView.setFocusableInTouchMode(false);
searchView.setMaxWidth(Integer.MAX_VALUE);
}
private void search(String query) {

View File

@ -16,7 +16,8 @@
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/toolbar_background_color"
app:navigationIcon="?attr/homeAsUpIndicator" />
app:navigationIcon="?attr/homeAsUpIndicator"
app:contentInsetStartWithNavigation="0dp" />
<RelativeLayout
android:layout_width="match_parent"

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.SearchView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:searchHintIcon="@null"
android:maxWidth="10000dp" />

View File

@ -6,5 +6,6 @@
android:title="@string/action_search"
android:icon="@android:drawable/ic_menu_search"
app:actionViewClass="android.support.v7.widget.SearchView"
android:actionLayout="@layout/search_view"
app:showAsAction="always" />
</menu>