本文整理匯總了Java中android.widget.ImageView.setOnClickListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.setOnClickListener方法的具體用法?Java ImageView.setOnClickListener怎麽用?Java ImageView.setOnClickListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ImageView
的用法示例。
在下文中一共展示了ImageView.setOnClickListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.widget.ImageView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ImageView mBtnDel = (ImageView) findViewById(R.id.btn_del);
mBtnDel.setOnClickListener(this);
mBtnDel.setVisibility(View.VISIBLE);
topBar.findViewById(R.id.btn_back).setOnClickListener(this);
mTitleCount.setText(getString(R.string.preview_image_count, mCurrentPosition + 1, mImageItems.size()));
//滑動ViewPager的時候,根據外界的數據改變當前的選中狀態和當前的圖片的位置描述文本
mViewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
mCurrentPosition = position;
mTitleCount.setText(getString(R.string.preview_image_count, mCurrentPosition + 1, mImageItems.size()));
}
});
}
示例2: initViews
import android.widget.ImageView; //導入方法依賴的package包/類
private void initViews() {
setClickable(true);
setBackgroundColor(getResources().getColor(R.color.rc_normal));
RelativeLayout recognizerContainer = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.rc_view_recognizer, null);
imgMic = (ImageView) recognizerContainer.findViewById(R.id.img_mic);
imgMic.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
startRecognize();
}
});
TextView tvClear = (TextView) recognizerContainer.findViewById(R.id.btn_clear);
tvClear.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (null != resultCallBack) {
resultCallBack.onClearClick();
}
}
});
rlBottom = (RelativeLayout) recognizerContainer.findViewById(R.id.rl_bottom);
addView(recognizerContainer);
random = new Random();
}
示例3: getItemView
import android.widget.ImageView; //導入方法依賴的package包/類
public View getItemView(int position, View convertView, ViewHolder holder) {
CustomFood food = (CustomFood) getItem(position);
if (food != null) {
ImageView civ_title = (ImageView) holder.getView(R.id.civ_icon);
TextView tv_calory = (TextView) holder.getView(R.id.tv_calory);
TextView tv_unit = (TextView) holder.getView(R.id.tv_unit);
ImageView iv_health_light = (ImageView) holder.getView(R.id.iv_light);
((TextView) holder.getView(R.id.tv_name)).setText(food.food_name);
ImageLoader.getInstance().displayImage(food.image_url, civ_title, ImageLoaderOptions
.global((int) R.drawable.aa2));
if (TextUtils.isEmpty(food.calory) || TextUtils.isEmpty(food.calory)) {
tv_calory.setText("0");
} else {
tv_calory.setText(Math.round(Float.parseFloat(food.calory)) + "");
}
tv_unit.setText(String.format(" 千卡/%1$s%2$s", new Object[]{food.amount, food
.unit_name}));
iv_health_light.setBackgroundResource(R.drawable.a9a);
iv_health_light.setOnClickListener(new DelListener(position));
}
return convertView;
}
示例4: initView
import android.widget.ImageView; //導入方法依賴的package包/類
private void initView() {
lightOff = (ImageView) findViewById(R.id.light_off);
lightOn = (ImageView) findViewById(R.id.light_on);
ImageView setImg = (ImageView) findViewById(R.id.main_setting);
ImageView backWifiList = (ImageView) findViewById(R.id.back_wifi_list);
ImageView setTimeImg = (ImageView) findViewById(R.id.main_set_time);
if (lightOff != null && lightOn != null && setImg != null && setTimeImg != null && backWifiList != null) {
lightOff.setOnClickListener(this);
lightOn.setOnClickListener(this);
setImg.setOnClickListener(this);
backWifiList.setOnClickListener(this);
setTimeImg.setOnClickListener(this);
}
}
示例5: init
import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public void init(Context context) {
super.init(context);
bottomProgressBar = (ProgressBar) findViewById(R.id.bottom_progressbar);
titleTextView = (TextView) findViewById(R.id.title);
backButton = (ImageView) findViewById(R.id.back);
thumbImageView = (ImageView) findViewById(R.id.thumb);
coverImageView = (ImageView) findViewById(R.id.cover);
loadingProgressBar = (ProgressBar) findViewById(R.id.loading);
tinyBackImageView = (ImageView) findViewById(R.id.back_tiny);
thumbImageView.setOnClickListener(this);
backButton.setOnClickListener(this);
tinyBackImageView.setOnClickListener(this);
}
示例6: createImageView
import android.widget.ImageView; //導入方法依賴的package包/類
private ImageView createImageView(int position, final boolean isMultiImage) {
String url = imagesList.get(position);
ImageView imageView = new ColorFilterImageView(getContext());
if(isMultiImage){
imageView.setScaleType(ScaleType.CENTER_CROP);
imageView.setLayoutParams(position % MAX_PER_ROW_COUNT == 0 ?moreParaColumnFirst : morePara);
}else {
imageView.setAdjustViewBounds(true);
imageView.setScaleType(ScaleType.CENTER_CROP);
imageView.setMaxHeight(pxOneMaxWandH);
imageView.setLayoutParams(onePicPara);
}
imageView.setTag(R.string.zone_img_position,position);
imageView.setId(url.hashCode());
imageView.setOnClickListener(mImageViewOnClickListener);
ImageLoaderUtils.display(getContext(), imageView, ImageUtil.getImageUrl(url));
return imageView;
}
示例7: AlbumViewHolder
import android.widget.ImageView; //導入方法依賴的package包/類
@SuppressLint("CutPasteId")
public AlbumViewHolder(View itemView) {
super(itemView);
if (layoutID == R.layout.item_grid_view || layoutID == R.layout.recent_list) {
AlbumArtwork = (ImageView) itemView.findViewById(R.id.album_artwork);
AlbumName = (TextView) itemView.findViewById(R.id.album_name);
ArtistName = (TextView) itemView.findViewById(R.id.artist_name);
menu = (ImageButton) itemView.findViewById(R.id.menu_button);
backgroundColor = (LinearLayout) itemView.findViewById(R.id.backgroundColor);
AlbumArtwork.setOnClickListener(this);
itemView.setOnClickListener(this);
itemView.findViewById(R.id.item_view).setOnClickListener(this);
}
if (layoutID == R.layout.item_list_view) {
AlbumListArtwork = (CircleImageView) itemView.findViewById(R.id.album_artwork);
AlbumListName = (TextView) itemView.findViewById(R.id.listalbumname);
ArtistListName = (TextView) itemView.findViewById(R.id.listartistname);
AlbumListArtwork.setOnClickListener(this);
itemView.findViewById(R.id.item_view).setOnClickListener(this);
itemView.setOnClickListener(this);
}
}
示例8: findview
import android.widget.ImageView; //導入方法依賴的package包/類
private void findview(View v) {
mTextureView = (TextureView) v.findViewById(R.id.tv_textview);
mButton = (Button) v.findViewById(R.id.btn_takepic);
mThumbnail = (ImageView) v.findViewById(R.id.iv_Thumbnail);
mThumbnail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getActivity(), "別戳了,那個頁麵還沒寫", Toast.LENGTH_SHORT).show();
}
});
}
示例9: onCreate
import android.widget.ImageView; //導入方法依賴的package包/類
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_routeplan);
mTvtitle = (TextView) findViewById(R.id.tv_topbar_title);
mTvtitle.setText("財神穀地址");
ImageView img = (ImageView) findViewById(R.id.img_topbar_back);
img.setImageResource(R.mipmap.icon_back);
img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
RoutePlanDemo.this.finish();
}
});
// mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);//獲取傳感器管理服務
// 初始化地圖
mMapView = (MapView) findViewById(R.id.map);
mBaidumap = mMapView.getMap();
MapStatus.Builder builder = new MapStatus.Builder();
builder.zoom(18.0f);
builder.target(new LatLng(29.184662, 121.305024));
mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(builder.build());
mBaidumap.setMapStatus(mMapStatusUpdate);
MarkerOptions ooA = new MarkerOptions().position(GEO_NINGBO).icon(bdA)
.zIndex(9).draggable(true);
mBaidumap.addOverlay(ooA);
mBaidumap.setTrafficEnabled(true);
findViewById(R.id.lin_action_route).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
go2ThirdMap();
}
});
}
示例10: addIconTab
import android.widget.ImageView; //導入方法依賴的package包/類
public void addIconTab(int resId) {
final int position = tabCount++;
ImageView tab = new ImageView(getContext());
tab.setFocusable(true);
tab.setImageResource(resId);
tab.setScaleType(ImageView.ScaleType.CENTER);
tab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
delegate.onPageSelected(position);
}
});
tabsContainer.addView(tab);
tab.setSelected(position == currentPosition);
}
示例11: ItemHolder
import android.widget.ImageView; //導入方法依賴的package包/類
public ItemHolder(View itemView) {
super(itemView);
mIconImage = (ImageView) itemView.findViewById(R.id.listViewLeftIcon);
mTitle = (TextView) itemView.findViewById(R.id.listViewTitleText);
mSubTitle = (TextView) itemView.findViewById(R.id.listViewSubText);
duration = (TextView) itemView.findViewById(R.id.listViewRightSubText);
duration.setVisibility(View.INVISIBLE);
mTitle.setTypeface(TypefaceHelper.getTypeface(itemView.getContext().getApplicationContext(), TypefaceHelper.FUTURA_BOOK));
mSubTitle.setTypeface(TypefaceHelper.getTypeface(itemView.getContext().getApplicationContext(), TypefaceHelper.FUTURA_BOOK));
mOverFlow = (ImageView) itemView.findViewById(R.id.listViewOverflow);
mOverFlow.setOnClickListener(this);
mOverFlow.setVisibility(View.VISIBLE);
mOverFlow.setOnClickListener(this);
itemView.setOnClickListener(this);
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) itemView.getLayoutParams();
params.height = (int) mApp.convertDpToPixels(72.0f, mContext);
itemView.setLayoutParams(params);
mIconImage.setScaleX(0.55f);
mIconImage.setScaleY(0.55f);
}
示例12: onCreateView
import android.widget.ImageView; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_report, container, false);
iv_menu = (ImageView) view.findViewById(R.id.iv_menu);
iv_menu.setOnClickListener(this);
textTitle = (TextView) view.findViewById(R.id.tvTitle);
textTitle.setText(R.string.baobiao);
btn_add = (Button) view.findViewById(R.id.btn_add);
btn_add.setVisibility(View.INVISIBLE);
webView = (WebView) view.findViewById(R.id.helpWebview);
pbWebView = (ProgressBar) view.findViewById(R.id.pbWebView);
ib_back = (ImageButton) view.findViewById(R.id.ib_back);
ib_back.setOnClickListener(this);
ib_back.setVisibility(View.INVISIBLE);
ib_refresh = (ImageButton) view.findViewById(R.id.ib_refresh);
ib_refresh.setOnClickListener(this);
//啟用支持javascript
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
getReportForm();
return view;
}
示例13: getLeftMenu
import android.widget.ImageView; //導入方法依賴的package包/類
@SuppressLint("InflateParams")
@Override
public View getLeftMenu(Activity activity) {
ImageView iv = (ImageView) LayoutInflater.from(activity).inflate(R.layout.top_right_iv, null);
iv.setImageResource(R.drawable.add);
iv.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onDragBottom(false);
}
});
return iv;
}
示例14: initView
import android.widget.ImageView; //導入方法依賴的package包/類
private void initView() {
StatusBarUtil.setTransparent(this);
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.root);
mScrollLayout = (ScrollLayout) findViewById(R.id.scroll_down_layout);
/**設置 setting*/
mScrollLayout.setMinOffset(DisplayUtils.dp2px(this, 50));
mScrollLayout.setMaxOffset(DisplayUtils.getScreenHeightPixels(this) - DisplayUtils.dp2px(this, 320));
mScrollLayout.setIsSupportExit(false);
mScrollLayout.setAllowHorizontalScroll(true);
mScrollLayout.getBackground().setAlpha(0);
relativeLayout.setOnClickListener(v -> mScrollLayout.scrollToExit());
mLocation = (ImageView) findViewById(R.id.location);
mLocation.setOnClickListener(this);
}
示例15: showImageViewDialog
import android.widget.ImageView; //導入方法依賴的package包/類
/**
* show dialog for Google drive image
*/
private void showImageViewDialog() {
int rotate = 0;
String fileName = getFilesDir().getPath() + "/temp.jpg";
try {
ExifInterface exif = new ExifInterface(fileName);
int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0);
switch (exifOrientation) {
case ExifInterface.ORIENTATION_NORMAL: rotate = 0; break;
case ExifInterface.ORIENTATION_ROTATE_90: rotate = 90; break;
case ExifInterface.ORIENTATION_ROTATE_180: rotate = 180; break;
case ExifInterface.ORIENTATION_ROTATE_270: rotate = 270; break;
}
} catch (IOException e) {
e.printStackTrace();
return;
}
// create bitmap from file
Bitmap bitmap = BitmapFactory.decodeFile(fileName);
if (bitmap == null) {
return;
}
// rotate by orientation
Matrix mat = new Matrix();
mat.postRotate(rotate);
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), mat, true);
// create dialog
final Dialog dialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
dialog.setContentView(R.layout.dialog_image_view);
ImageView imageView = (ImageView) dialog.findViewById(R.id.image_view);
imageView.setImageBitmap(bitmap);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.show();
}