简体   繁体   中英

Android ListActivity custom Typeface

I have several ListActivities, in which I need to set up, for each row, cusom typeface I am loading from assets. In TextView this is not a problem, but I am facing problem of accessing my list items. ListActivity seems to not have method *.setTypeface(), so I have come to the dead end. Anyone had faced same problem before?

How are you populating your ListView? Most likely you are using one of the generic ListAdapter implementations which seem to only provide bare-bones functionality and not much else.

My suggestion would be to design your own View to use in your ListView along with your own ArrayAdapter implementation that configures type face etc. from within it's getView(...) method. You'll find quite a few tutorials on the subject if you google "custom android ArrayAdapter".

You do not set the type face on the listview. You need to set the typeface on a textview. So use a custom array adapter for your listview, inflate your own custom view which would contain a textview, and then set the typeface on that text view.

To go along with what Nick said, google "custom android arrayadapter"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM