android - How to do RelativeLayout with images like gridview? -
i neew display images gridview in scrollview. as read not right use gridview in scrollview. need big image text, list ao images , thet in 1 fragment need scrollview, first one, images without text there way display images programmatically 1 after in relativelayout(like in gridview)?
here got, not working, images overlay each other.
(string pic : mflat.getadv_pics()){ i++; imageview imageview = new imageview(mactivity); imageview.setid(i); relativelayout.layoutparams params = new relativelayout.layoutparams(relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); params.addrule(relativelayout.align_parent_left, relativelayout.true); params.addrule(relativelayout.right_of, i-1); imageview.setlayoutparams(params); log.d("!!!!", "" + + "|" + imageview.getid()); log.d("!!!!", "http://****" + pic + "_small.jpg"); relativelayout.addview(imageview); picasso.with(mactivity) .load("http://****" + pic + "_small.jpg") .resize(width,width) .centercrop() .into(imageview); } }
thanks
there reason gridview exists , creating such layout far more complex , way harder handle (events ,positions..) using other views combo. need display listview inside realtivelayout, , item of listview row of custom grid. example want display 3 images on every row:
your main xml this:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <listview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/listview"/> </relativelayout>
and listview adapter item this:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageview1"/> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageview2"/> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageview3"/> </relativelayout>
now need pass nested array adapter ,each item of array contain 3 images , on.but main problem handle events , need rethink it.
Comments
Post a Comment