Reputation: 1
I have an ListView element in my layout,with other views:
...
<ListView android:layout_height="wrap_content" android:id="@+id/listView1" android:layout_width="match_parent" android:visibility="gone" android:></ListView>
...
when the Activity is created I fill the Listview with an Array of values:
ListView list_ultime_ricette=(ListView) findViewById(R.id.listView1);
list_ultime_ricette.setVisibility(android.view.View.VISIBLE);
list_ultime_ricette.setAdapter(new ArrayAdapter<String>(Home.this, R.layout.list_item, ricette_name));
And this is list_item.xml:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="16dp" >
But when I try the whole, I see only the first element of my array, does anyone know why?
Upvotes: 0
Views: 2189
Reputation: 13585
Try changing list_item.xml to be this:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="16dp" >
Only change is settings layout_height to "wrap_content" instead of "fill_parent".
Upvotes: 1