在我的應用我使用parse.com導入多個字符串值和列表視圖更改
看到圖像列表他們的Android字符串的顏色(與parse.com實現) - http://postimg.org/image/onpyj0ro5/
我來這裏的目的就是要改變上述圖像編程(不是.xml文件)中所示的兩個字符串值的顏色
我曾嘗試推行SpannableString & SpannableStringBuilder,但沒有成功。
.xml文件:
listview_main_wednesday.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ListView
android:id="@+id/listview_wednesday"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</RelativeLayout>
listview_item_wednesday.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:padding="5sp"
android:textSize="15sp"
android:textColor="@color/list_background"
/>
我的片段代碼
protected void onPostExecute(Void result){
listview = (ListView) getView().findViewById(R.id.listview_wednesday);
adapter = new ArrayAdapter<String>(getActivity(), R.layout.listview_item_wednesday);
for (ParseObject country : ob) {
adapter.add((String) country.get("pSubject") + "\n" + "\n" + (String) country.get("pTime"):
}
listview.setAdapter(adapter);
mProgressDialog.dismiss();
}
}
任何幫助將是非常AP preciated :)
不能你得到文本視圖的ID和設置文本的顏色嗎? –
我認爲你需要創建一個自定義適配器。這樣你可以單獨訪問'textView'。除非你想讓他們都改變一樣 –
我正在考慮這一點,我的恐懼是需要很長時間來執行,不幸的是時間不在我身邊。你知道哪些例子/教程可以幫助嗎? –