出于某种原因,我无法在SearchView上设置字体。 这里是我的代码,试图改变字体:Android - SearchView - setTypeface不可用
searchView = findViewById(R.id.searchview_invite_friends_search_contact);
Typeface myFont = Typeface.createFromAsset(getAssets(),"fonts/myFont.ttf");
searchView.setTypeface(myFont);
我在XML中定义它像这样:
<SearchView
android:id="@+id/searchView"
android:layout_width="match_parent"
android:queryHint="@string/searchview_invite_friends_search_contact"
android:iconifiedByDefault="false"
android:layout_centerHorizontal="true"
android:background="@android:color/white"
android:searchIcon="@drawable/icon_search"
android:focusable="false"
android:layout_height="45dp"
android:queryBackground="@color/transparent"
android:gravity="center_horizontal"
>
工作绝对好多了:)谢谢! – Isabelle