android - unusual Listview error -
i made small android application maintains list of video files on sd-card , plays it. using listview text , 2 images in each row. problem noticed quite usual. in horizontal mode, list items fit screen area appears normal while items require scrolling appeared, either in wrong order or repetition of items in top of list. moreover, scrolling , down, order of items changes.. using 2 xml files. first list view , second contents of listview. here code both xml files
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <listview android:id="@+id/list" android:listselector="@android:color/transparent" android:divider="@drawable/bwgradient" android:dividerheight="1.5px" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </linearlayout> <?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="wrap_content"> <imageview android:id="@+id/image" android:layout_width="50dip" android:layout_height="50dip" android:layout_margintop="2dip" android:layout_marginbottom="2dip" android:src="@drawable/cover" android:scaletype="centercrop"/> <textview android:id="@+id/text" android:state_focused="false" android:listselector="#00000000" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="left|center_vertical" android:textsize="14dip" android:layout_marginleft="20dip"/> <imageview android:id="@+id/play" android:layout_width="30dip" android:layout_height="30dip" android:src="@drawable/play" android:onclick="imageclick" android:layout_gravity="center" android:layout_marginright="20dip" android:scaletype="centercrop"/> </linearlayout> any possible suggestion ??
when orientation changes horizontal portrait , vice verse,the activity recreate itself(the activity object destroyed , new activity object create).see docs http://developer.android.com/reference/android/app/activity.html#configurationchanges more information
Comments
Post a Comment