android - Scroll effect for RecyclerView -


i using horisontal recyclerview in android app.
showing 2 items (imageviews) on screen @ time.

to setting width of each imageview half of screen in viewholder class of adapter:

  public static class viewholder extends recyclerview.viewholder {     private linearlayout ll_img;         private imageview iv_ad;           private viewholder(view v) {             super(v);              ll_img = (linearlayout) itemview.findviewbyid(r.id.ll_img);             ll_img.getlayoutparams().width = (utils.getscreenwidth(itemview.getcontext()) / 2);              iv_ad = (imageview) v.findviewbyid(r.id.iv_main_ad);         }     } 

and getting scrren width:

public static int getscreenwidth(context context) {      windowmanager wm = (windowmanager) context.getsystemservice(context.window_service);     display display = wm.getdefaultdisplay();     point size = new point();     display.getsize(size);     int screenwidth = size.x;      return screenwidth; } 

it works fine want implement scroll effect on ios,
scroll 1 item per swipe,
after each swipe 2 items must fit screen width.

by way, 2 videos worth 1000 words
here having now: https://drive.google.com/file/d/0b7j1rf_oueblowk1outpwxfpcee/view?usp=sharing

and want achieve (as colleague implemented on ios): https://drive.google.com/file/d/0b6b-4-itg1eqtelntwsxmwg4aws/view?usp=sharing

each piece of advice appreciated

this viewpager, not recyclerview. link might https://commonsware.com/blog/2012/08/20/multiple-view-viewpager-options.html

just else's benefit:

getpagewidth() returns floating-point number, between 0 , 1, representing portion of width of viewpager given page should take up. default, page width 1, overriding this, can have multiple pages on screen simultaneously.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -