1. 程式人生 > >安卓改變searchview字型的顏色等

安卓改變searchview字型的顏色等

這裡要針對2種searchview進行操作,

通常的
- SearchView

 SearchView mSearchViewInclude;
int id =mSearchViewInclude.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
TextView textView = (TextView) searchView.findViewById(id);
textView.setTextColor(Color.WHITE);

v7包裡的:

  • android.support.v7.widget.SearchView
SearchView.SearchAutoComplete textView = (SearchView.SearchAutoComplete)mSearchViewInclude.findViewById(R.id.search_src_text);
        textView.setTextColor(getResources().getColor(R.color.text_color_normal));
        textView.setHintTextColor(getResources().getColor(R.color.text_color_hint));
        textView.setTextSize
(TypedValue.COMPLEX_UNIT_SP,13);

3.對於改變游標顏色

還是使用主題色改變吧,把colorAccent改為自己游標的顏色即可

  <item name="colorAccent">#27C084</item>