K
Karuso33
Neues Mitglied
- 0
Hallo,
ich habe vor kurzem einen "eigenen" ListView Adapter aufgesetzt.
Um dann mithilfe eine Routine, wie etwa dieser hier
Einträge hinzuzufügen.
Hier noch meine xml Datei aus der die Felder maintvTxt1,2,3 kommen:
So, nun meine Frage: wie kann ich diese TextView jeweils anders Farbig gestalten, spich Zeile 1 das maintvTxt1 z.B. rot und Zeile 2 z.B. gelb
Danke im Vorraus
Karuso33
ich habe vor kurzem einen "eigenen" ListView Adapter aufgesetzt.
Code:
SimpleAdapter adapter = new SimpleAdapter(
this,
list,
R.layout.main_list_item_layout,
new String[] {"subject","grade","teacher"},
new int[] {R.id.maintvTxt1,R.id.maintvTxt2, R.id.maintvTxt3}
);
Um dann mithilfe eine Routine, wie etwa dieser hier
Code:
HashMap<String,String> temp = new HashMap<String,String>();
temp.put("subject","Deutsch");
temp.put("grade", "3-");
temp.put("teacher", "Silver, Grey, Black");
list.add(temp);
Hier noch meine xml Datei aus der die Felder maintvTxt1,2,3 kommen:
Code:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="100">
<LinearLayout
android:layout_width="fill_parent"
android:weightSum="100"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView android:id="@+id/maintvTxt1"
android:textSize="16sp"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_weight="20"
android:layout_height="fill_parent"/>
<TextView android:id="@+id/maintvTxt2"
android:textSize="20sp"
android:layout_gravity="left"
android:gravity="left"
android:textColor="#B2B2B2"
android:paddingRight="12dp"
android:layout_weight="80"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
<TextView android:id="@+id/maintvTxt3"
android:typeface="sans"
android:textSize="14sp"
android:textStyle="italic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
So, nun meine Frage: wie kann ich diese TextView jeweils anders Farbig gestalten, spich Zeile 1 das maintvTxt1 z.B. rot und Zeile 2 z.B. gelb
Danke im Vorraus
Karuso33
Zuletzt bearbeitet: