How to create toolbar searchview in flutter

With the help @aziza answer i write detail code snippet of search view with list filter below. it will help for others import ‘package:flutter/material.dart’; class SearchList extends StatefulWidget { SearchList({ Key key }) : super(key: key); @override _SearchListState createState() => new _SearchListState(); } class _SearchListState extends State<SearchList> { Widget appBarTitle = new Text(“Search Sample”, style: … Read more

Styling a SearchView in Android Action Bar

I have been spending many time for this but finally: 🙂 To change the text color : ((EditText)searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text)).setTextColor(Color.WHITE); or this one for AndroidX: ((EditText)searchView.findViewById(androidx.appcompat.R.id.search_src_text)).setTextColor(Color.WHITE); To change the text hint: ((EditText)searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text)).setHintTextColor(Color.WHITE); or this one for AndroidX: ((EditText)searchView.findViewById(androidx.appcompat.R.id.search_src_text)).setHintTextColor(Color.WHITE);

Changing the cursor color in SearchView without ActionBarSherlock

Based on the comments and answers above I made an example of how this could look using reflection. This solves the problem in my app. Hope it saves someone else some time. @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.entity_list_actions, menu); final SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); final int textViewID = searchView.getContext().getResources().getIdentifier(“android:id/search_src_text”,null, null); final AutoCompleteTextView searchTextView … Read more

SearchView.OnCloseListener does not get invoked

I ran into same problem on android 4.1.1. Looks like it is a known bug: https://code.google.com/p/android/issues/detail?id=25758 Anyway, as a workaround i used state change listener (when SearchView is detached from action bar, it is also closed obviously). view.addOnAttachStateChangeListener(new OnAttachStateChangeListener() { @Override public void onViewDetachedFromWindow(View arg0) { // search was detached/closed } @Override public void onViewAttachedToWindow(View … Read more

How to set SearchView TextSize?

You can achieve this using a theme: in styles.xml <style name=”AppSearchView” parent=”Widget.AppCompat.SearchView” > <item name=”android:textSize”>60sp</item> </style> And using a SearchView <android.support.v7.widget.SearchView android:id=”@+id/searchView” android:layout_width=”350dp” app:theme=”@style/AppSearchView” android:layout_height=”80dp” android:layout_marginTop=”15dp”/>

Android SearchView Filter ListView

Place this inside your adapter: @Override public Filter getFilter(){ return new Filter(){ @Override protected FilterResults performFiltering(CharSequence constraint) { constraint = constraint.toString().toLowerCase(); FilterResults result = new FilterResults(); if (constraint != null && constraint.toString().length() > 0) { List<String> founded = new ArrayList<String>(); for(YourListItemType item: origData){ if(item.toString().toLowerCase().contains(constraint)){ founded.add(item); } } result.values = founded; result.count = founded.size(); }else { … Read more

SearchView in OptionsMenu not full width

Instead of creating a new layout I set the MaxWidth programmatically in onCreateOptionsMenu(): @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_search, menu); SearchView searchView = (SearchView)menu.findItem(R.id.menu_search).getActionView(); searchView.setMaxWidth(Integer.MAX_VALUE); ….