很抱歉,如果这对其他人来说是显而易见的,但我在理解如何在listview中显示html方面遇到了一些小麻烦.
我的列表视图已声明.
ListView lv1 = (ListView) findViewById(R.id.ListView01);
我填充它(未显示)然后使用ArrayAdapter设置我的listview.
lv1.setAdapter(new ArrayAdapter(SearchByFood.this, R.layout.new_list_view, foods));
再往下我创建一个新的字符串数组,我希望在其中加入粗体标记.然后我将这个新数组(称为arr_sort)添加到arrayadapter中,并使用onTextChanged()方法.
lv1.setAdapter(new ArrayAdapter(SearchByFood.this, R.layout.new_list_view, arr_sort));
所以现在我的新数组字符串已经< b>标签在里面.如何使listview显示粗体文本? 这是我的new_list_view
android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/grey2"
android:textSize="20sp"
android:gravity="center_vertical"
android:paddingLeft="6dip"
android:minHeight="40dip"
/>
这是我的主要布局中的ListView部分.
android:id="@+id/ListView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/rounded_corners_green"
android:cacheColorHint="#00000000"
android:divider="@color/green6"
android:dividerHeight="1px"
android:fastScrollEnabled="true" >
任何帮助将非常感激.