Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. public class A extends PagerAdapter {

 


  2. public A() {
}



  3. @Override

  4. public int getCount() {
return 16;
}


  5. @Override

  6. public boolean isViewFromObject(View view, Object object) {

  7. return view == ((LinearLayout) object);
}


  8. @Override

  9. public Object instantiateItem(ViewGroup container, int position) {

  10. View v = inflate(v, container, false);

 

  11. ImageView i = (ImageView) v.findViewById(R.id.i);

  12. i.setImageResource(drawable);


  13. return v;

  14. }


  15. @Override

  16. public int getItemPosition(Object object) {
return POSITION_NONE;
}

 


  17. @Override

  18. public void destroyItem(ViewGroup container, int position, Object
  19. object)
  20. {
container.removeView((LinearLayout) object);
}


 

  21. @Override

  22. public float getPageWidth(int position) {
return (0.25f);
}


  23. }
  24.  
  25. <android.support.v4.view.ViewPager
  26. android:id="@+id/v"
  27. android:layout_width="wrap_content"
  28. android:layout_height=“100dp”
  29. android:scrollbarAlwaysDrawHorizontalTrack="true"
  30. android:scrollbarStyle="insideOverlay"
  31. android:scrollbars="horizontal">
  32. <android.support.v4.view.PagerTitleStrip
  33. android:id="@+id/p”
  34. android:layout_width="wrap_content"
  35. android:layout_height="wrap_content"
  36. android:layout_gravity="top"
  37. />
  38. </android.support.v4.view.ViewPager>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement