Skip to content

Commit

Permalink
fix : Search Bar Allignment Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shiv07tiwari authored and therajanmaurya committed Jan 15, 2019
1 parent 052fdf7 commit d2340c7
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
Expand Down Expand Up @@ -310,6 +311,10 @@ private void initSearch(Menu menu, final AccountType account) {
search = (SearchView) menu.findItem(R.id.menu_search_share).getActionView();
}

DisplayMetrics displayMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int width = displayMetrics.widthPixels;
search.setMaxWidth((int) (0.75 * width));
search.setSearchableInfo(manager.getSearchableInfo(getActivity().getComponentName()));
search.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
Expand Down

0 comments on commit d2340c7

Please sign in to comment.