android.widget.Gallery.setSelection()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(188)

本文整理了Java中android.widget.Gallery.setSelection()方法的一些代码示例,展示了Gallery.setSelection()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Gallery.setSelection()方法的具体详情如下:
包路径:android.widget.Gallery
类名称:Gallery
方法名:setSelection

Gallery.setSelection介绍

暂无

代码示例

代码示例来源:origin: novoda/android-demos

@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    Gallery gallery = (Gallery) inflater.inflate(R.layout.carousel_gallery, null);

    gallery.setAdapter(new GalleryAdapter(mContext));
    gallery.setOnItemClickListener(new OnItemClickListener() {
      public void onItemClick(AdapterView<?> l, View v, int position, long id) {
        count = position;
        ((Carousel) mContext).setSelectedId(id);
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.hide(fragment);
        ft.commit();
      }
    });

    gallery.requestFocus();
    gallery.setSelection(mCurCheckPosition);

    return gallery;
  }
}

代码示例来源:origin: redfish64/TinyTravelTracker

@Override
public void onResume() {
  super.onResume();
  if(adapter == null)
    return;
  //TODO 2.1 use startActivityForResult and use the picture selected in that screen as the position
  gallery.setSelection(lastGalleryPosition >= mlts.size() ? mlts.size()-1 : lastGalleryPosition);
  adapter.notifyDataSetChanged();
  gtum.registerMediaGalleryFragment(this);
  
  
}

代码示例来源:origin: stackoverflow.com

class GalleryContentFactory implements TabContentFactory{
  private ImageAdapter imageAdapter;
  public GalleryContentFactory(ImageAdapter imageAdapter){
    this.imageAdapter = imageAdapter;
  }
  public View createTabContent(String tag){
    Gallery sampleGallery = new Gallery(getApplicationContext());
    sampleGallery.setLayoutParams(new ViewGroup.LayoutParams(
      ViewGroup.LayoutParams.FILL_PARENT,
      ViewGroup.LayoutParams.WRAP_CONTENT));
    sampleGallery.setGravity(Gravity.FILL_VERTICAL);
    sampleGallery.setSpacing(5);
    sampleGallery.setAdapter(imageAdapter);
    sampleGallery.setSelection(1);
    return sampleGallery;
  }
}

代码示例来源:origin: stackoverflow.com

g.setSelection(i++);

代码示例来源:origin: Wilm0r/giggity

@Override
public void onScroll(AbsListView v, int first, int visible, int total) {
  ScheduleViewActivity.onScroll(ctx);
  if (!scrolling)
    return;
  /* Find the first real item currently on-screen. */
  while (scroller.getList().get(first).getClass() != Schedule.Item.class && first < total)
    first++;
  if (first == total)
    return; /* Hmm. Just titles, no events? */
  int to;
  for (to = 0; to < tents.size(); to ++)
    if (tents.get(to) == ((Schedule.Item)scroller.getList().get(first)).getLine())
      tentSel.setSelection(to);
}

代码示例来源:origin: stackoverflow.com

rightArrow.setVisibility(View.VISIBLE);
gallery.setSelection(selectedImagePosition, true);
gallery.setSelection(selectedImagePosition, true);
if (drawables.size() > 0) {
  gallery.setSelection(selectedImagePosition, true);

代码示例来源:origin: LiuGuiLinAndroid/LoveWallpaper

mGallery.setSelection(position);

代码示例来源:origin: stackoverflow.com

mGallery.setSelection(iTemp);

相关文章