So ändern Sie die Textfarbe bei listView

Eigentlich will ich den text ändern der Farbe von der listview, die ich erstellt hatte, für meine app..eigentlich, wenn ich die bacground Farbe des listview-weiß der text vorhanden, in dem listview wird nicht als text angezeigt, die Farbe ist auch weiß..also ist es eine Möglichkeit, ändern Sie den text Farbe des listview-schwarz, so dass es sichtbar ist in der listView..ich sende meinen code u bitte überprüfen Sie es..

XML-code:

  <LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"

xmlns:android="http://schemas.android.com/apk/res/android">

<LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:orientation="vertical">
    <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout2" android:layout_width="match_parent">
    <TextView android:text="All Contacts" 
        android:id="@+id/textView1" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:background="#808080"
        android:textColor="#000000">
        </TextView>
    </LinearLayout>
 <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout2" android:layout_width="match_parent"> 
   <ListView android:id="@+id/ListView01"

android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

Java-code:

private ListView lv1;
    private String lv_arr[]={"Android","iPhone","BlackBerry","AndroidPeople","Android","iPhone"};
    @Override
    public void onCreate(Bundle icicle)
    {
        super.onCreate(icicle);
        setContentView(R.layout.contact_activity);
        lv1=(ListView)findViewById(R.id.ListView01);    
        lv1.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , lv_arr));

        lv1.setOnItemClickListener(new OnItemClickListener() 
        {

            public void onItemClick(AdapterView<?> parent, View view,int position, long id) 
            {

                      String selecteditem = lv_arr[position];
                      Intent myIntent = new Intent(view.getContext(), ContactInfo.class);
                      myIntent.putExtra("item", selecteditem);
                      startActivity(myIntent);
            }
        });
    }       
InformationsquelleAutor AndroidDev | 2011-06-24
Schreibe einen Kommentar