I have one list in which I show the data that I received, it works fine in the emulator and scrolls. But when I test it on the device while scrolling, it shows a black screen and after scrolling stops in the usual readable form. I do not understand why this is happening. I am also attaching a sample code.
XML 1st format: -
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="7dp" > <TextView android:id="@+id/item_title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="2dp" android:textColor="#000000" android:textAppearance="?android:attr/textAppearanceMedium" android:textSize="20dp" /> <TextView android:id="@+id/item_subtitle" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#000000" android:padding="2dp" android:textAppearance="?android:attr/textAppearanceMedium" android:textSize="13dp" />
Second ListView layout: -It also has a scroll view.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFFFFF"> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:drawSelectorOnTop="false" /> <TextView android:id="@android:id/empty" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="No data" android:textColor="#000000" />
The code in which I used these layouts: -
ListAdapter adapter = new SimpleAdapter(this, HomeMenuActivity.mylist , R.layout.listdata, new String[] { "Name", "Vicinity" }, new int[] { R.id.item_title, R.id.item_subtitle }); setListAdapter(adapter); lv = getListView(); lv.setTextFilterEnabled(true);
I have a static arraylist "mylist" that has data. Please, if someone knows why he is showing a black screen while scrolling, please help me.
Thanks. lv.setOnItemClickListener (this);
source share