當前位置: 首頁>>代碼示例>>Java>>正文


Java Gallery.setAdapter方法代碼示例

本文整理匯總了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));
}
 
開發者ID:yeriomin,項目名稱:YalpStore,代碼行數:20,代碼來源:FullscreenImageActivity.java

示例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));
}
 
開發者ID:liningwang,項目名稱:camera,代碼行數:22,代碼來源:PictrueView.java

示例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));
}
 
開發者ID:LouiLam,項目名稱:Android-Image-Cache-master,代碼行數:19,代碼來源:InteractiveDemo.java

示例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);
}
 
開發者ID:Sherchen,項目名稱:ApiDemos,代碼行數:24,代碼來源:Gallery2.java

示例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);
}
 
開發者ID:Sherchen,項目名稱:ApiDemos,代碼行數:19,代碼來源:ImageSwitcher1.java

示例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;
}
 
開發者ID:soziotech,項目名稱:Fishification,代碼行數:18,代碼來源:FeedFishFragment.java

示例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);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:13,代碼來源:Wallpaper.java

示例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); // 設置圖片之間的間距
}
 
開發者ID:AskViky,項目名稱:CommunityService,代碼行數:16,代碼來源:GalleryActivity.java

示例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();
}
 
開發者ID:roadlabs,項目名稱:alternate-java-bridge-library,代碼行數:18,代碼來源:ImageGallery.java

示例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;
}
 
開發者ID:ScilCoop,項目名稱:pasteque-android,代碼行數:38,代碼來源:PaymentFragment.java

示例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);
}
 
開發者ID:slartus,項目名稱:4pdaClient-plus,代碼行數:11,代碼來源:BbCodesBasePanel.java

示例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

  }
 
開發者ID:emop,項目名稱:EmopAndroid,代碼行數:28,代碼來源:HotActivity.java

示例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;
}
 
開發者ID:pengqinping,項目名稱:androidProject,代碼行數:30,代碼來源:WallpaperChooserDialogFragment.java

示例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);
	}
}
 
開發者ID:yftx,項目名稱:fruit.thememanager,代碼行數:39,代碼來源:ThemeApplyActivity.java

示例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;
}
 
開發者ID:Kwamecorp,項目名稱:Fairphone,代碼行數:30,代碼來源:WallpaperChooserDialogFragment.java


注:本文中的android.widget.Gallery.setAdapter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。