我正在开发一个具有项目列表视图的Android应用程序。这些listview记录是从sqlite数据库查询的。下面是列表视图执行代码:Android - 更改ListView项目的TextStyle
DataBaseHelper myDbHelper = new DataBaseHelper(null);
myDbHelper = new DataBaseHelper(this);
private static final String fields[] = {"c"};
int[] names = new int[] {R.id.name};
client1 = (ListView)findViewById(R.id.list1);
String sql = "SELECT sno,a,b,c,d FROM (SELECT com.sno, com.a, com.b com.c,cd.d from table1 mem inner join table2 cd on mem.e=cd.e inner join table3 com on com.b = mem.b where mem.e =14445 AND a is NULL UNION SELECT com.sno, com.a, com.b,com.c,cd.d from table1 mem inner join table3 com on com.b = mem.b inner join table2 cd on mem.e=cd.e where mem.e =14445 AND a is NOT NULL) a group by a,b;";
Cursor cdata = myDbHelper.getView(sql);
SimpleCursorAdapter adapter2 = new SimpleCursorAdapter(this,R.layout.list1, cdata, fields,names);
client1.setAdapter(adapter2);
其中list1.xml是:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/MainLayout"
android:padding="5px">
<TextView
android:id="@+id/name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:textColor="#104082"
android:textStyle="bold"
android:layout_weight="1"
/>
</LinearLayout>
这里我的问题是区分有 'A'= NULL和 'a'=数据记录通过更改列表视图项目的文本样式,从同一个list1.xml中的notnull ....可以通过在查询中提供任何文本样式属性来区分sql查询中的文本样式吗?
提前