Codota Logo
GalleryViewPager
Code IndexAdd Codota to your IDE (free)

How to use
GalleryViewPager
in
com.nie.ngallerylibrary

Best Java code snippets using com.nie.ngallerylibrary.GalleryViewPager (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: niezhiyang/NGallery

  @Override
  public void onClick(View v) {
    if ((mViewPager.getCurrentItem() ) == position) {
      Toast.makeText(mContext, "点击的位置是:::"+position, Toast.LENGTH_SHORT).show();
    }
  }
});
origin: niezhiyang/NGallery

  @Override
  public boolean onTouch(View v, MotionEvent event) {
    return mViewPager.dispatchTouchEvent(event);
  }
});
origin: niezhiyang/NGallery

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  if(ev.getAction() == MotionEvent.ACTION_DOWN){
    downX = ev.getX();
    downY = ev.getY();
  }else if (ev.getAction() == MotionEvent.ACTION_UP) {
    float upX = ev.getX();
    float upY = ev.getY();
    //如果 up的位置和down 的位置 距离 > 设置的距离,则事件继续传递,不执行下面的点击切换事件
    if(Math.abs(upX - downX) > DISTANCE || Math.abs(upY - downY) > DISTANCE){
      return super.dispatchTouchEvent(ev);
    }
    View view = viewOfClickOnScreen(ev);
    if (view != null) {
      int index = (Integer) view.getTag();
      if (getCurrentItem() != index) {
        setCurrentItem(index);
      }
    }
  }
  return super.dispatchTouchEvent(ev);
}
origin: niezhiyang/NGallery

int childCount = getChildCount();
int currentIndex = getCurrentItem();
int[] location = new int[2];
for (int i = 0; i < childCount; i++) {
  View v = getChildAt(i);
  int position = (Integer) v.getTag();
  v.getLocationOnScreen(location);
origin: niezhiyang/NGallery

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mViewPager = (GalleryViewPager) findViewById(R.id.viewpager);
  mViewPager.setPageTransformer(true, new ScalePageTransformer());
  findViewById(R.id.root).setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
      return mViewPager.dispatchTouchEvent(event);
    }
  });
  mPagerAdapter = new SimpleAdapter(this);
  mViewPager.setAdapter(mPagerAdapter);
  initData();
}
origin: niezhiyang/NGallery

private void initData() {
  List<Integer> list = new ArrayList<>();
  list.add(R.drawable.wo);
  list.add(R.drawable.wo1);
  list.add(R.drawable.wo2);
  list.add(R.drawable.wo3);
  list.add(R.drawable.wo4);
  list.add(R.drawable.wo5);
  list.add(R.drawable.wo);
  list.add(R.drawable.wo1);
  //设置OffscreenPageLimit
  mViewPager.setOffscreenPageLimit(Math.min(list.size(), 5));
  mPagerAdapter.addAll(list);
}
com.nie.ngallerylibraryGalleryViewPager

Javadoc

on 2017/5/23. 类的描述:

Most used methods

  • getCurrentItem
  • dispatchTouchEvent
  • getChildAt
  • getChildCount
  • setAdapter
  • setCurrentItem
  • setOffscreenPageLimit
  • setPageTransformer
  • viewOfClickOnScreen

Popular in Java

  • Reactive rest calls using spring rest template
  • getApplicationContext (Context)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • startActivity (Activity)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now