本文整理匯總了Java中android.widget.Gallery.setSelection方法的典型用法代碼示例。如果您正苦於以下問題:Java Gallery.setSelection方法的具體用法?Java Gallery.setSelection怎麽用?Java Gallery.setSelection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.Gallery
的用法示例。
在下文中一共展示了Gallery.setSelection方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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); // 設置圖片之間的間距
}
示例4: 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;
}
示例5: 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);
}