我正在開發一個具有項目列表視圖的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查詢中的文本樣式嗎?
提前