Android ListView with main View - timeline effect - possible? -
how can create this?
i want have "selected image" main view, , time line effect @ bottom; gallery
work, has been deprecated.
i'm thinking horizontalscrollview
@ bottom, recycle view
s properly? can implement viewholder
pattern here?
what stackview
? found this: http://www.gdgankara.org/2012/03/25/stackview-non-widget-sample/ cool, couldn't find lot of things stackview
s online, i'm wondering how gets implemented?
i solved problem using custom horizontal listview
mukesh yadav
i changed horizontalimageadapter.java
class use cursoradapter
.
my solution here:
public class horizontalimageadapter extends cursoradapter { //...some initialization here public horizontalimageadapter(context context, cursor c, int count) { super(context, c, true); this.context = (activity) context; this.count = count; this.cursor = c; inflater = layoutinflater.from(context); cursor.movetofirst(); } private static class viewholder { public imageview imageview; public textview textview; public imageview imageviewvideo; } @override public view getview(int position, view convertview, viewgroup parent) { viewholder holder = null; cursor.movetoposition(position); if (convertview == null) { log.d(tag, "converview == null <<<<<<<<<<<<<<<<<<<<<<<<"); convertview = inflater.inflate(r.layout.activity_media_items, null); holder = new viewholder(); holder.textview = (textview) convertview.findviewbyid(r.id.tv_details_title); holder.imageview = (imageview) convertview.findviewbyid(r.id.iv_details_resource_image); holder.imageviewvideo = (imageview) convertview.findviewbyid(r.id.iv_details_resource_video); convertview.settag(holder); } else { log.d(tag, "converview != null >>>>>>>>>>>>>>>>>>>>>>>>"); } //get type of item type = cursor.getstring(cursor.getcolumnindex(databasehelper.field_item_type)); if(type.equalsignorecase("text")){ //handle text item } if(type.equalsignorecase("image")){ //handle image item } if(type.equalsignorecase("video")){ //handle video item } return convertview; } @override public void bindview(view view, context context, cursor cursor) { viewholder holder = (viewholder) view.gettag(); string title = cursor.getstring(cursor.getcolumnindex(databasehelper.field_title)); string filename = cursor.getstring(cursor.getcolumnindex(databasehelper.field_resource)); } @override public view newview(context context, cursor cursor, viewgroup parent) { viewholder holder = new viewholder(); view eachitem = inflater.inflate(r.layout.activity_media_items, parent, false); holder.textview = (textview) eachgrid.findviewbyid(r.id.tv_details_title); holder.imageview = (imageview) eachgrid.findviewbyid(r.id.iv_details_resource_image); holder.imageviewvideo = (imageview) eachgrid.findviewbyid(r.id.iv_details_resource_video); eachgrid.settag(holder); return eachitem; } }
and xml:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@android:color/black" > <imageview android:id="@+id/selected_imageview" android:layout_width="@dimen/exhibit_item_width" android:layout_height="@dimen/exhibit_item_height" android:layout_gravity="center" android:layout_margintop="10dp" android:layout_weight="1" android:maxheight="@dimen/exhibit_item_height" android:maxwidth="@dimen/exhibit_item_width" android:src="@drawable/logo" /> <relativelayout android:id="@+id/gallery_relative_layout" android:layout_width="wrap_content" android:layout_height="@dimen/exhibit_items_height" android:layout_gravity="bottom" android:layout_weight="1" android:gravity="center" android:orientation="horizontal" > <com.example.testdatabase2.horizontalview android:id="@+id/gallery" android:layout_width="match_parent" android:layout_height="@dimen/exhibit_items_height" android:layout_centerhorizontal="true" android:smoothscrollbar="true" android:spacing="20dip" > </com.example.testdatabase2.horizontalview > </relativelayout> </linearlayout>
Comments
Post a Comment