android.widget.Gallery类的使用及代码示例

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

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

Gallery介绍

暂无

代码示例

代码示例来源: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: stackoverflow.com

mGallery.setOnItemSelectedListener(this);
mGallery.setCallbackDuringFling(false);

代码示例来源:origin: robolectric/robolectric

@Override public AdapterView createAdapterView() {
  return new Gallery(ApplicationProvider.getApplicationContext());
 }
}

代码示例来源:origin: androidquery/androidquery

public void listen(Gallery gallery){
  
  galleryListener = gallery.getOnItemSelectedListener();
  galleryListen = true;
  
  gallery.setOnItemSelectedListener(this);
}

代码示例来源:origin: nostra13/Android-Universal-Image-Loader

@SuppressWarnings("deprecation")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  View rootView = inflater.inflate(R.layout.fr_image_gallery, container, false);
  Gallery gallery = (Gallery) rootView.findViewById(R.id.gallery);
  gallery.setAdapter(new ImageAdapter(getActivity()));
  gallery.setOnItemClickListener(new OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
      startImagePagerActivity(position);
    }
  });
  return rootView;
}

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

gallery.setUnselectedAlpha(1.0f);
gallery.setSpacing((int) Util.convertDpToPixel(10, this));
gallery.setOnItemClickListener(new OnItemClickListener() {
  public void onItemClick(AdapterView parent, View v, int position, long id) {
    MediaLocTime mlt = mlts.get((int)id);
gallery.setAdapter(adapter = new MltAdapter(this, mlts));

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

gallery.setAdapter(new ImageAdapter(this));     
gallery.setOnItemSelectedListener(new OnItemSelectedListener() {

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

objects.add(getResources().getDrawable(R.drawable.icon));
objects.add(getResources().getDrawable(R.drawable.icon));
g.setAdapter(new CustomAdapter(this, objects));
g.setOnItemSelectedListener(new OnItemSelectedListener() {
  g.setSelection(i++);

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

gallery.setAdapter(new ImageAdapter(this)); 
gallery.setSpacing(0); 
gallery.setOnItemSelectedListener(new OnItemSelectedListener() {

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

tentSel = new Gallery(ctx);
tentSel.setAdapter(new TentListAdapter(ctx, tents));
tentSel.setSpacing(0);
tentSel.setBackgroundResource(R.color.primary);
app.setShadow(tentSel, true);
lp = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
tentSel.setOnItemSelectedListener(tentSelL);

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

ga.setAdapter(new ImageAdapter(this));
ga.setOnItemSelectedListener(new OnItemSelectedListener() {
ga.setOnItemClickListener(new OnItemClickListener() {

代码示例来源: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

mGallery.setOnTouchListener(this);
mGallery.setAdapter(new GalleryAdapter(this, mImageBuffer));
mGallery.setSelection(iTemp);
          final int iPosition = mGallery.pointToPosition((int)event.getX(), (int)event.getY());
            final int iVisibleViewIndex = iPosition - mGallery.getFirstVisiblePosition();
            View child = mGallery.getChildAt(iVisibleViewIndex);
            if (child != null)

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

gallery.setSpacing(1);
gallery.setAdapter(new GalleryImageAdapter(this));
gallery.setOnItemClickListener(new OnItemClickListener() {
  public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    Toast.makeText(MainActivity.this, "Your selected position = " + position, Toast.LENGTH_SHORT).show();

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

super.onCreate(icicle);
Gallery gallery = new Gallery(this);
gallery.setAdapter(new MyApater());

代码示例来源:origin: xingkongus/superXingPostCard

/**
 * Use this to provide a {@link CoverFlowAdapter} to the coverflow. This
 * method will throw an {@link ClassCastException} if the passed adapter does not
 * subclass {@link CoverFlowAdapter}.
 *
 * @param adapter
 */
@Override
public void setAdapter(SpinnerAdapter adapter) {
  if (!(adapter instanceof CoverFlowAdapter)) {
    throw new ClassCastException(CoverFlowAdapter.class.getSimpleName() + " only works in conjunction with a " + CoverFlowAdapter.class.getSimpleName());
  }
  super.setAdapter(adapter);
}

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

g.setAdapter(optionAdapter);
g.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
  @Override
  public void onItemSelected(AdapterView<?> list, View view, int position, long id) {
  @Override
  public void onClick(View view){
    g.onFling(null, null, 2000, 0);
  @Override
  public void onClick(View view){
    g.onFling(null, null, -2000, 0);

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

mGallery.setAdapter(new GalleryAdapter(this, mListBigUrl));
mGallery.setSelection(position);

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

setContentView(R.layout.display);
Gallery cf=(Gallery)this.findViewById(R.id.Gallery);
cf.setSpacing(20);
cf.setAdapter(imageAdapter);
cf.setAnimationDuration(1500);

代码示例来源: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);
  
  
}

相关文章