From d2340c70023b417e52c73d6f50c0f7ae111c9676 Mon Sep 17 00:00:00 2001 From: Shivansh Date: Wed, 9 Jan 2019 20:57:54 +0530 Subject: [PATCH] fix : Search Bar Allignment Issue --- .../mobilebanking/ui/fragments/ClientAccountsFragment.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/org/mifos/mobilebanking/ui/fragments/ClientAccountsFragment.java b/app/src/main/java/org/mifos/mobilebanking/ui/fragments/ClientAccountsFragment.java index 26299befa..4de4d9ab6 100644 --- a/app/src/main/java/org/mifos/mobilebanking/ui/fragments/ClientAccountsFragment.java +++ b/app/src/main/java/org/mifos/mobilebanking/ui/fragments/ClientAccountsFragment.java @@ -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; @@ -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