I have tried these approaches which did not work -
Approach 1:
val searchView = binding.mSearchView
val linearLayout1 = searchView.getChildAt(0) as LinearLayout
val linearLayout2 = linearLayout1.getChildAt(2) as LinearLayout
val linearLayout3 = linearLayout2.getChildAt(1) as LinearLayout
val autoComplete = linearLayout3.getChildAt(0) as AutoCompleteTextView
autoComplete.textSize = 12f
Approach 2:
<string name="search_hint"><font size="12">My hint string</font></string>
val searchSrcTextId = resources.getIdentifier("android:id/search_src_text", null,
null)
val searchEditText = binding.mSearchView.findViewById<View>(searchSrcTextId) as
EditText
searchEditText.hint = getString(R.string.search_hint)
This gives Null Pointer exception on line 3.
Approach 3:
<string name="search_hint"><font size="12">My hint string</font></string>
binding.mSearchView.queryHint = getString(R.string.search_hint)
Or
binding.mSearchView.queryHint = getText(R.string.search_hint)
Approach 4:
binding.mSearchView.queryHint = Html.fromHtml("<small><small>
<small>"+getString(R.string.hint)
+ "</small></small></small>")
I want to change queryHint text size to 12sp of my androidx.appcompat.widget.SearchView.
Please help, i have tried everything i could, but not able to do it. Thanks in advance! :)