Search code examples
androidlistviewandroid-intentandroid-arrayadapterlistadapter

How I see the Full ListView in my Android Application


I write for testing a Android Application with a ListView. This ListView I fill with a ListAdapter and it works fine. Only if I start the Application I don't see the Full ListView :(

enter image description here

Here is my activity_main.xml

<?xml version="1.0" encoding="utf-8" ?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:orientation="vertical">

   <ListView
       android:id="@+id/listview1"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       ></ListView>

</LinearLayout>

Here is my MainActivity.java

package de.linde.listview;

import java.util.ArrayList;
import java.util.List;
import android.os.Bundle;
import android.app.Activity;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        List valueList = new ArrayList<String>(); 

        for(int i=0;i<10;i++)
        {
            valueList.add("value" + i); 
        }

        ListAdapter adapter = new ArrayAdapter<String>(getApplicationContext(),android.R.layout.simple_list_item_1,valueList); 

        final ListView lv = (ListView)findViewById(R.id.listview1);
        lv.setAdapter(adapter); 
    }

}

What I make wrong :(?


Solution

  • Problem with your text color.

    try to change text color or background color of listviwe.

    it will work sure.

      <ListView
       android:background="#C0C0C0" <------
       android:id="@+id/listview1"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content">
       </ListView>