2
したがって、既にassetsViewフォルダにあるカスタムフォント(hello.ttf)をListViewに設定しようとしています。以下は私のjavaとxmlファイルです。ListViewのカスタムフォント
faListFragment.java
public class faListFragment extends Fragment {
public faListFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_fa_list, container, false);
String[] faList = { "One",
"Two",
};
ListView listView = (ListView) view.findViewById(R.id.listFa);
ArrayAdapter<String> listviewAdapter = new ArrayAdapter<String>(
getActivity(),
android.R.layout.simple_list_item_1,
faList
);
listView.setAdapter(listviewAdapter);
// Inflate the layout for this fragment
return view;
}
}
、これが私のfragment_fa_list.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.me.hello.faListFragment">
<!-- TODO: Update blank fragment layout -->
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listFa" />
</FrameLayout>
である私は、フォントを追加するいくつかの方法を試してみましたが、カントはかなりいるようですそれについてどうやって行くのか把握する。
私はこれにかなり従っていませんでした。 –
TextViewのCustomFontについては、これを行う必要があります。新しいものを見つけたら、私にもお勧めしてください。 –
はあなたがそれよりも少し詳細であれば納得するでしょう。私はJavaとAndroidの開発には非常に新しいです。 –