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

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

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

Gallery.setAdapter介绍

暂无

代码示例

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

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

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

gallery.setAdapter(new MyApater());

代码示例来源:origin: it.tidalwave.bluebill/it-tidalwave-bluebill-mobile-android-taxonomy-factsheet

public void run()
  {
   gaThumbnailStrip.setAdapter(listAdapter = new PresentationModelAdapter(getContext(), stillImagesPM));
  }
});

代码示例来源: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: jiangqqlmj/Android-Universal-Image-Loader-Modify

@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: stackoverflow.com

gallery.setAdapter(new ImageAdapter(this));

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

g.setAdapter(new ImageAdapter(this));
g.setOnItemSelectedListener(this);

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

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

gallery.setAdapter(new ImageAdapter(this)); 
gallery.setSpacing(0);

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

super.onCreate(savedInstanceState);
Gallery g = new Gallery(this);
    g.setAdapter(new ImageAdapter(this));
    setContentView(g);

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

setContentView(R.layout.main);
Gallery g=(Gallery)findViewById(R.id.gallery);
g.setAdapter(new ImageAdapter(this));
 g.setSpacing(10);
 g.setOnItemSelectedListener(this);

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

selectedImage=(ImageView)findViewById(R.id.imageView1);
gallery.setSpacing(1);
gallery.setAdapter(new GalleryImageAdapter(this));

代码示例来源:origin: livroandroid/5ed

@Override
public void onCreate(Bundle icicle) {
  super.onCreate(icicle);
  getActionBar().setDisplayHomeAsUpEnabled(true);
  setContentView(R.layout.activity_exemplo_gallery);
  Gallery g = (Gallery) findViewById(R.id.gallery);
  g.setAdapter(new ImagemAdapter(this, imagens));
  g.setOnItemClickListener(onGalleryItemClick(this));
}

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

((Gallery) v.findViewById(R.id.gallery)).setAdapter(adapter = 
  new MltAdapter(getActivity(), inflater, mlts));

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

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

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

gallery.setAdapter(adapter = new MltAdapter(this, mlts));

相关文章