本文整理汇总了Java中android.widget.Gallery.setAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java Gallery.setAdapter方法的具体用法?Java Gallery.setAdapter怎么用?Java Gallery.setAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.Gallery
的用法示例。
在下文中一共展示了Gallery.setAdapter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onNewIntent
import android.widget.Gallery; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (null == DetailsActivity.app) {
Log.w(getClass().getSimpleName(), "No app stored");
finish();
return;
}
Gallery gallery = ((Gallery) findViewById(R.id.gallery));
gallery.setAdapter(new FullscreenImageAdapter(
this,
DetailsActivity.app.getScreenshotUrls(),
getWindowManager().getDefaultDisplay().getWidth(),
getWindowManager().getDefaultDisplay().getHeight()
));
gallery.setSelection(intent.getIntExtra(INTENT_SCREENSHOT_NUMBER, 0));
}
示例2: onCreate
import android.widget.Gallery; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
gallery = (Gallery) findViewById(R.id.gallery);
bitmap = SDUtil.getImagePathFromSD();
imageAdapter = new ImageAdapter(this, bitmap.size());
gallery.setAdapter(imageAdapter);
gallery.setOnItemSelectedListener(this);
gallery.setSelection(1);// 璁剧疆涓�鍔犺浇Activity灏辨樉绀虹殑鍥剧墖涓虹浜屽紶
gallery.setOnItemClickListener(this);
iv = (ImageView) findViewById(R.id.iv);
//imageSwitcher.setFactory(this);
// 璁剧疆鍔ㄧ敾鏁堟灉 娣″叆娣″嚭
//imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
//imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
}
示例3: onCreate
import android.widget.Gallery; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Gallery gallery = (Gallery) findViewById(R.id.gallery);
mCache = ImageCache.getInstance(this);
mCache.setCacheMaxSize(1 * 1024 /* mega */* 1024 /* kilo */);
initData();
setListAdapter(TestData.generateAdapter(this, mTestData, R.layout.thumbnail_item, mCache,
320, 200));
gallery.setAdapter(TestData.generateAdapter(this, mTestData, R.layout.small_thumbnail_item,
mCache, 160, 100));
}
示例4: onCreate
import android.widget.Gallery; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gallery_2);
// Get a cursor with all people
Cursor c = getContentResolver().query(Contacts.CONTENT_URI,
CONTACT_PROJECTION, null, null, null);
startManagingCursor(c);
SpinnerAdapter adapter = new SimpleCursorAdapter(this,
// Use a template that displays a text view
android.R.layout.simple_gallery_item,
// Give the cursor to the list adatper
c,
// Map the NAME column in the people database to...
new String[] {Contacts.DISPLAY_NAME},
// The "text1" view defined in the XML template
new int[] { android.R.id.text1 });
Gallery g = (Gallery) findViewById(R.id.gallery);
g.setAdapter(adapter);
}
示例5: onCreate
import android.widget.Gallery; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.image_switcher_1);
mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
mSwitcher.setFactory(this);
mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_in));
mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_out));
Gallery g = (Gallery) findViewById(R.id.gallery);
g.setAdapter(new ImageAdapter(this));
g.setOnItemSelectedListener(this);
}
示例6: onCreateView
import android.widget.Gallery; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
m_view = inflater.inflate(R.layout.fragment_fish_feed, container, false);
m_defaultBackground = m_view.getBackground();
// Init Gallery
Gallery gallery = (Gallery) m_view.findViewById(R.id.fishBoxGallery);
gallery.setAdapter(new FishFoodBoxAdapter(m_view.getContext()));
// Init Sensor
Context context = m_view.getContext();
m_sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
m_lastUpdate = System.currentTimeMillis();
return m_view;
}
示例7: onCreate
import android.widget.Gallery; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.wallpaper);
mGallery = (Gallery) findViewById(R.id.gallery);
mGallery.setAdapter(new ImageAdapter(this));
mGallery.setOnItemSelectedListener(this);
mGallery.setOnItemClickListener(this);
}
示例8: initViews
import android.widget.Gallery; //导入方法依赖的package包/类
@Override
protected void initViews(Bundle savedInstanceState) {
setContentView(R.layout.activity_gallery);
mGallery = (Gallery) findViewById(R.id.gallery);
mImgAdapter = new GalleryAdapter(this);
mGallery.setAdapter(mImgAdapter); // 设置图片资源
mGallery.setGravity(Gravity.CENTER_HORIZONTAL); // 设置水平居中显示
mGallery.setSelection(mImgAdapter.mImgs.length * 100); // 设置起始图片显示位置(可以用来制作gallery循环显示效果)
mGallery.setOnItemClickListener(mClickListener); // 设置点击图片的监听事件(需要用手点击才触发,滑动时不触发)
mGallery.setOnItemSelectedListener(mSelectedListener); // 设置选中图片的监听事件(当图片滑到屏幕正中,则视为自动选中)
mGallery.setUnselectedAlpha(0.3f); // 设置未选中图片的透明度
mGallery.setSpacing(40); // 设置图片之间的间距
}
示例9: ImageGallery
import android.widget.Gallery; //导入方法依赖的package包/类
/**
* Non GLE component constructor.
*
* @param container The container to place this ImageGallery into
* @param picnames A string array of the names of the pictures in the gallery
* @param basestyle This should always be R.styleable.ImageGallery
*/
public ImageGallery(ComponentContainer container, String[] picnames, int[] basestyle) {
super(container);
view = new Gallery(container.$context());
adapter = new ImageAdapter(container.$context(), basestyle);
adapter.setFiles(picnames);
view.setAdapter(adapter);
view.setOnItemClickListener(this);
container.$add(this);
view.requestLayout();
}
示例10: onCreateView
import android.widget.Gallery; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.payment_zone, container, false);
mPaymentModes = (Gallery) layout.findViewById(R.id.payment_modes);
List<PaymentMode> modes = Data.PaymentMode.paymentModes(mContext);
mPaymentModes.setAdapter(new PaymentModesAdapter(modes));
mPaymentModes.setOnItemSelectedListener(new PaymentModeItemSelectedListener());
mPaymentModes.setSelection(0, false);
mCurrentMode = modes.get(0);
mInput = (EditText) layout.findViewById(R.id.input);
mInput.setInputType(InputType.TYPE_NULL); // Should be TextView.
mNumberPad = (NumKeyboard) layout.findViewById(R.id.numkeyboard);
mNumberPad.setKeyHandler(new Handler(this));
mPaymentsList = (ListView) layout.findViewById(R.id.payments_list);
mPaymentsList.setAdapter(new PaymentsAdapter(mPaymentsListContent, this));
mRemaining = (TextView) layout.findViewById(R.id.ticket_remaining);
mGiveBack = (TextView) layout.findViewById(R.id.give_back);
mCusInfo = (LinearLayout) layout.findViewById(R.id.user_characteristic);
mCusPrepaid = (TextView) layout.findViewById(R.id.custPrepaidAmount);
mCusDebt = (TextView) layout.findViewById(R.id.currentDebt);
mCusDebtMax = (TextView) layout.findViewById(R.id.mountMax);
LinearLayout customerList = (LinearLayout) layout.findViewById(R.id.customers_list);
customerList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mListener.onPfCustomerListClick();
}
});
updateView();
return layout;
}
示例11: BbCodesBasePanel
import android.widget.Gallery; //导入方法依赖的package包/类
public BbCodesBasePanel(Context context, Gallery gallery, EditText editText,
IGetBitmap getBitmap) {
mContext = context;
m_GetBitmapFunc = getBitmap;
initVars();
gallery.setAdapter(new ImageAdapter(context, getImages()));
txtPost = editText;
gallery.setSelection(3, true);
}
示例12: onCreate
import android.widget.Gallery; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hot_cate_view);
client = FmeiClient.getInstance(this);
Gallery mGallery = (Gallery)findViewById(R.id.header_banner);
actAdapter = this.loadLinkActivityAdapter();
mGallery.setAdapter(actAdapter);
mGallery.setOnItemClickListener(itemClick);
//Log.d(Constants.TAG_EMOP, "dp:150 -> px:" + cateHeight);
Rect displayRectangle = new Rect();
Window window = getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);
winWidth = displayRectangle.width();
timer = new Timer();
AutoChangePager l = new AutoChangePager(mGallery);
timer.scheduleAtFixedRate(l, 1000, 3000);
mGallery.setOnFocusChangeListener(l);
//mGallery.s
}
示例13: onCreateView
import android.widget.Gallery; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
findWallpapers();
/* If this fragment is embedded in the layout of this activity, then we should
* generate a view to display. Otherwise, a dialog will be created in
* onCreateDialog()
*/
if (mEmbedded) {
View view = inflater.inflate(R.layout.wallpaper_chooser, container, false);
view.setBackgroundDrawable(mWallpaperDrawable);
final Gallery gallery = (Gallery) view.findViewById(R.id.gallery);
gallery.setCallbackDuringFling(false);
gallery.setOnItemSelectedListener(this);
gallery.setAdapter(new ImageAdapter(getActivity()));
View setButton = view.findViewById(R.id.set);
setButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
selectWallpaper(gallery.getSelectedItemPosition());
}
});
return view;
}
return null;
}
示例14: initView
import android.widget.Gallery; //导入方法依赖的package包/类
private void initView() {
// TODO Auto-generated method stub
mTitleView = (TextView) findViewById(R.id.theme_title);
mApplyButton = (TextView) findViewById(R.id.theme_apply);
mDeleteButton = (ImageView) findViewById(R.id.theme_delete);
mPreviewGallery = (Gallery) findViewById(R.id.theme_gallery);
mPreviewIndicator = (ViewGroup) findViewById(R.id.theme_preview_indicator);
//set title
mTitleView.setText(mThemeInfo.mThemeName);
//set delete button state
mApplyButton.setOnClickListener(this);
if(mThemeInfo.mThemeType == ThemeType.THEME_DEFAULT || isSysAppPackage(mThemeInfo.mPkgName)){
mDeleteButton.setVisibility(View.GONE);
}else{
mDeleteButton.setOnClickListener(this);
}
//get preview image
final String[] previewList = getPreviewImageList(mThemeCategory);
final int size = (previewList == null) ? 0 : previewList.length;
mAdapter = new PrevImageAdapter(this, previewList);
mPreviewGallery.setAdapter(mAdapter);
mPreviewGallery.setOnItemSelectedListener(this);
// Select image indicator
LayoutInflater inflater = LayoutInflater.from(this);
for (int i = 0; i < size; i++) {
ImageView indicator = (ImageView) inflater.inflate(R.layout.theme_nav_item, null);
mPreviewIndicator.addView(indicator);
}
if(size < 2){
mPreviewIndicator.setVisibility(View.INVISIBLE);
}else{
mPreviewIndicator.getChildAt(0).setSelected(true);
}
}
示例15: onCreateView
import android.widget.Gallery; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
findWallpapers();
/* If this fragment is embedded in the layout of this activity, then we should
* generate a view to display. Otherwise, a dialog will be created in
* onCreateDialog()
*/
if (mEmbedded) {
View view = inflater.inflate(R.layout.wallpaper_chooser, container, false);
view.setBackground(mWallpaperDrawable);
final Gallery gallery = (Gallery) view.findViewById(R.id.gallery);
gallery.setCallbackDuringFling(false);
gallery.setOnItemSelectedListener(this);
gallery.setAdapter(new ImageAdapter(getActivity()));
View setButton = view.findViewById(R.id.set);
setButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
selectWallpaper(gallery.getSelectedItemPosition());
}
});
return view;
}
return null;
}