我怎样才能改变我的ListView项目的字体? [英] How can I change the font of my ListView items?

查看:183
本文介绍了我怎样才能改变我的ListView项目的字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我想创建一个自定义的设计,我的列表视图中的问题,但我不知道该怎么办。我使用的是SQL数据库,这是在我的列表视图。哈哈对不起,我dont't知道怎么说这个......因为IM german..so顺便说一句对不起我的ENGLSIH。这里是我的code:

I have the problem that i would like to create an custom design for my list view but I don't know how to do. I use a sql database which is in my list view. haha sorry I dont't know how to say this...because im german..so by the way sorry for my englsih. here is my code:

private void populateListViewFromDB() {
    Cursor cursor = myDb.getAllRows();

    startManagingCursor(cursor);


    String[] fromFieldNames = new String[] 
            {DBAdapter.KEY_NAME, DBAdapter.KEY_STUDENTNUM, DBAdapter.KEY_FAVCOLOUR, DBAdapter.KEY_STUDENTNUM};
    int[] toViewIDs = new int[]
            {R.id.item_name,     R.id.item_icon,           R.id.item_favcolour,     R.id.item_studentnum};


    SimpleCursorAdapter myCursorAdapter = 
            new SimpleCursorAdapter(
                    this,       
                    R.layout.item_layout,   
                    cursor,                 
                    fromFieldNames,         
                    toViewIDs               
                    );

    // Set the adapter for the list view
    ListView myList = (ListView) findViewById(R.id.listViewFromDB);
    myList.setAdapter(myCursorAdapter);
}

感谢您的帮助!)

推荐答案

试试这个办法,希望这将帮助你解决你的问题。

下面是问题的详细说明。

Here is a detailed explanation of the issue.

http://javatechig.com/android/using-external-字体功能于Android的观点

基本上适合你,因为它是在ListView我建议你创建自定义的TextView。重要的是把你的字体文件中的资产的文件夹。

Basically for you, since it's in a listview I recommend that you create the custom textview. It's important to place you font files in the assets folder.

这篇关于我怎样才能改变我的ListView项目的字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆