添加ListFragment的粗体单项

时间:2013-01-18 17:07:37

标签: android android-layout

我想让我的ListFragment的一些Itam加粗而另一个不是 (如下图所示)

代码是:

  public class ItemListFragment extends ListFragment {

         @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         DummyItem i0 = new DummyItem("0", "Welcome" + S.getUsername());
         DummyContent.addItem(i0);

                 //useless code

         DummyItem ichat = new DummyItem(String.valueOf(j), "Table Chat");
         DummyContent.addItem(ichat);
         j++;
         DummyItem iblackboard = new DummyItem(String.valueOf(j), "Black Board");
         DummyContent.addItem(iblackboard);
         setListAdapter(new ArrayAdapter<DummyContent.DummyItem>(getActivity(),
            android.R.layout.simple_list_item_activated_1,
            android.R.id.text1, DummyContent.ITEMS));

}
 }

非常感谢

enter image description here

1 个答案:

答案 0 :(得分:1)

您需要自定义listadapter。下面是一个教程http://www.vogella.com/articles/AndroidListView/article.html