Extends the width of the search view.

This commit is contained in:
Vavassor 2017-06-22 02:00:03 -04:00
parent 65e9d8c4fd
commit 100b9f0a47
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>