当前位置: 首页>>代码示例>>Java>>正文


Java Gallery.setOnItemSelectedListener方法代码示例

本文整理汇总了Java中android.widget.Gallery.setOnItemSelectedListener方法的典型用法代码示例。如果您正苦于以下问题:Java Gallery.setOnItemSelectedListener方法的具体用法?Java Gallery.setOnItemSelectedListener怎么用?Java Gallery.setOnItemSelectedListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.Gallery的用法示例。


在下文中一共展示了Gallery.setOnItemSelectedListener方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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));
}
 
开发者ID:liningwang,项目名称:camera,代码行数:22,代码来源:PictrueView.java

示例2: 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);
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:19,代码来源:ImageSwitcher1.java

示例3: 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);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:13,代码来源:Wallpaper.java

示例4: 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); // 设置图片之间的间距
}
 
开发者ID:AskViky,项目名称:CommunityService,代码行数:16,代码来源:GalleryActivity.java

示例5: 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;
}
 
开发者ID:ScilCoop,项目名称:pasteque-android,代码行数:38,代码来源:PaymentFragment.java

示例6: 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;
}
 
开发者ID:pengqinping,项目名称:androidProject,代码行数:30,代码来源:WallpaperChooserDialogFragment.java

示例7: 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);
	}
}
 
开发者ID:yftx,项目名称:fruit.thememanager,代码行数:39,代码来源:ThemeApplyActivity.java

示例8: 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;
}
 
开发者ID:Kwamecorp,项目名称:Fairphone,代码行数:30,代码来源:WallpaperChooserDialogFragment.java

示例9: listen

import android.widget.Gallery; //导入方法依赖的package包/类
public void listen(Gallery gallery)
{
	galleryListener = gallery.getOnItemSelectedListener();
	galleryListen = true;
	gallery.setOnItemSelectedListener(this);
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:7,代码来源:Common.java

示例10: onCreate

import android.widget.Gallery; //导入方法依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.wallpaper_chooser);


	skyBackground = getIntent().getBooleanExtra(Settings.SKY_MODE_BACKGROUND_IMAGE, false);

	if(skyBackground){
		setTitle(R.string.prefBackground);
		pics = FlagManager.getSkyBackgroundIds();
		listener = new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
				intent.setType("image/*");
				startActivityForResult(intent, PICKED_IMAGE);
			}
		};
	}
	else{
		listener = new OnClickListener() {
			public void onClick(View v) {
				Intent intent = new Intent(WallpaperChooser.this, PreviewActivity.class);
				intent.putExtra("flagId", (Integer) imageView.getTag());
				startActivity(intent);
			}
		};
		pics = FlagManager.getPortraitFlagIds();
	}

	txtInfo = (TextView) findViewById(R.id.txtImageInfo);

	Gallery gallery = (Gallery) findViewById(R.id.gallery);
	gallery.setAdapter(new FlagAdapter(this));
	gallery.setCallbackDuringFling(false);

	gallery.setOnItemSelectedListener(this);

	imageView = (ImageView)findViewById(R.id.imgFlag);

	prefs = PreferenceManager.getDefaultSharedPreferences(this);

	String texture = prefs.getString(Settings.SINGLE_FLAG_IMAGE_SETTING, FlagManager.getDefaultFlag());
	if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
		texture = FlagManager.toLandscape(texture);
	imageView.setImageResource(FlagManager.getFlagId(texture));
	imageView.setTag(FlagManager.getFlagId(texture));

	btnOk = (Button) findViewById(R.id.btnOk);
	btnOk.setOnClickListener(this);
	((Button) findViewById(R.id.btnCancel)).setOnClickListener(this);

	Display display = getWindowManager().getDefaultDisplay();
	thumbHeight = (display.getHeight()*30/100) - 20;
}
 
开发者ID:danilox6,项目名称:flag3dlivewallpaperbase,代码行数:59,代码来源:WallpaperChooser.java

示例11: onCreate

import android.widget.Gallery; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
	super.onCreate(icicle);
	
	requestWindowFeature(Window.FEATURE_NO_TITLE);

	findWallpapers();

	setContentView(R.layout.wallpaper_chooser);

	mGallery = (Gallery) findViewById(R.id.gallery);
	mGallery.setAdapter(new ImageAdapter(this));
	mGallery.setOnItemSelectedListener(this);
	mGallery.setCallbackDuringFling(false);

	btn_set = (Button)findViewById(R.id.set);
	btn_set.setOnClickListener(this);		

	mImageView = (ImageView) findViewById(R.id.wallpaper);
	
	handler = new Handler();
}
 
开发者ID:yftx,项目名称:fruit.launcher.wallpaper,代码行数:23,代码来源:WallpaperChooser.java

示例12: listen

import android.widget.Gallery; //导入方法依赖的package包/类
public void listen(Gallery gallery){
	
	galleryListener = gallery.getOnItemSelectedListener();
	galleryListen = true;
	
	gallery.setOnItemSelectedListener(this);
}
 
开发者ID:bblue000,项目名称:ExoPlayerDemo,代码行数:8,代码来源:Common.java

示例13: listen

import android.widget.Gallery; //导入方法依赖的package包/类
public void listen(Gallery gallery) {

		galleryListener = gallery.getOnItemSelectedListener();
		galleryListen = true;

		gallery.setOnItemSelectedListener(this);
	}
 
开发者ID:steven2947,项目名称:NeXT_pyp,代码行数:8,代码来源:Common.java


注:本文中的android.widget.Gallery.setOnItemSelectedListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。