Extends the width of the search view.

main
Vavassor 8 years ago
parent 9b0977cff0
commit 727d262e55
  1. 5
      app/src/main/java/com/keylesspalace/tusky/SearchActivity.java
  2. 3
      app/src/main/res/layout/activity_search.xml
  3. 8
      app/src/main/res/layout/search_view.xml
  4. 1
      app/src/main/res/menu/search_toolbar.xml

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

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

@ -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" />

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