Reputation: 301
I have a listview inside an AbsoluteLayout , and is not scrolling.
the XML is :
<ListView
android:id="@+id/listTrauma"
android:layout_width="fill_parent"
android:layout_height="178dp"
android:layout_x="0dp"
android:scrollbars="none"
android:layout_y="666dp" >
</ListView>
and the adapter code:
adapter = new ArrayAdapter<String>(getApplicationContext(),
R.layout.test1, dataTrauma);
Upvotes: 0
Views: 170
Reputation: 1329
Hey AbsoluteLayout is deprecated. Its good to use either LineaLayout or RelativeLayout.
You can go through this for more information. android:layout_height="0dp"
and android:layout_weight="1"
will occupy the space and add some elements in that list.It will scroll.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/widget0"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ListView
android:id="@+id/listTrauma"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:scrollbars="none"
android:layout_weight="1">
</ListView>
</LinearLayout>
And I guess in your case you have given a specific height to your list, I guess that's why it's not scrolling. I hope this helps.
Upvotes: 1
Reputation: 855
Use the RelativeLayout
instead of the AbsoluteLayout
. The AbsoluteLayout
was deprectated
in API level 3: http://developer.android.com/reference/android/widget/AbsoluteLayout.html
Upvotes: 0
Reputation: 63
You need to use linear layout instead of absolute layout. And also, edit your list view properties, and use something like this:
<ListView
android:id="@+id/listTrauma"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="none"/>
Upvotes: 1