本文整理了Java中android.widget.ImageView.getId()
方法的一些代码示例,展示了ImageView.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.getId()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:getId
暂无
代码示例来源:origin: chrisbanes/PhotoView
@Override
public void onPhotoTap(ImageView view, float x, float y) {
float xPercentage = x * 100f;
float yPercentage = y * 100f;
showToast(String.format(PHOTO_TAP_TOAST_STRING, xPercentage, yPercentage, view == null ? 0 : view.getId()));
}
}
代码示例来源:origin: smuyyh/BookReader
private void scale(View v, boolean isDown) {
if (v.getId() == qq.getId() || v.getId() == weibo.getId() || v.getId() == wechat.getId()) {
if (isDown) {
Animation testAnim = AnimationUtils.loadAnimation(mActivity, R.anim.scale_down);
v.startAnimation(testAnim);
} else {
Animation testAnim = AnimationUtils.loadAnimation(mActivity, R.anim.scale_up);
v.startAnimation(testAnim);
}
}
if (!isDown && listener!=null) {
switch (v.getId()) {
case R.id.ivQQ:
listener.onLogin(qq, "QQ");
break;
}
qq.postDelayed(new Runnable() {
@Override
public void run() {
dismiss();
}
}, 500);
}
}
代码示例来源:origin: stackoverflow.com
ImageView view = (ImageView) findViewById(R.id.someImage);
view.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
ImageView imageView = (ImageView) view;
assert(R.id.someImage == imageView.getId());
switch(getDrawableId(imageView)) {
case R.drawable.foo:
imageView.setDrawableResource(R.drawable.bar);
break;
case R.drawable.bar:
default:
imageView.setDrawableResource(R.drawable.foo);
break;
}
});
代码示例来源:origin: Bearded-Hen/Android-Bootstrap
LayoutParams closeParams = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
textParams.addRule(RelativeLayout.LEFT_OF, closeButton.getId());
closeParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
代码示例来源:origin: stackoverflow.com
ImageView view = (ImageView) findViewById(R.id.someImage);
view.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
ImageView imageView = (ImageView) view;
assert(R.id.someImage == imageView.getId());
Integer integer = (Integer) imageView.getTag();
integer = integer == null ? 0 : integer;
switch(integer) {
case R.drawable.foo:
imageView.setDrawableResource(R.drawable.bar);
imageView.setTag(R.drawable.bar);
break;
case R.drawable.bar:
default:
imageView.setDrawableResource(R.drawable.foo);
imageView.setTag(R.drawable.foo);
break;
}
});
代码示例来源:origin: stackoverflow.com
ImageView v = (ImageView)findViewbyId(R.id.img);
if(R.id.someId == v.getId())
{
//do something
}
else{
//do something
}
代码示例来源:origin: stackoverflow.com
addFoodAdapter.SetOnItemClickListener(new AddFoodAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
ImageView iv = (ImageView)view;// get imageView
int id = iv.getId();
if(id == R.id.ivDeleteFoodItem){
addFoodAdapter.delete(position);
}
}
});
代码示例来源:origin: stackoverflow.com
public int compare(ImageView computer, ImageView player) {
if (player.getId() == computer.getId())
return 1;
else
return 2;
}
代码示例来源:origin: stackoverflow.com
im.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
ImageView iv=(ImageView) v;
Log.e("sfas","-->"+iv.getId());
}
});
代码示例来源:origin: stackoverflow.com
public void startAnimation(ImageView image1) {
ImageView image2 = cardViewMap.get(cardSwapMap.get(image1.getId()));
animationController = new AnimationController(activity, image1, image2);
animationThread = new Thread(animationController);
animationThread.start();
}
代码示例来源:origin: stackoverflow.com
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
ImageView iv1 = new ImageView(context);
ImageView iv2 = new ImageView(context);
your_relative_layout.addView(iv1, layoutParams);
layoutParams.addRule(RelativeLayout.RIGHT_OF, iv1.getId());
your_relative_layout.addView(iv2, layoutParams);
代码示例来源:origin: SwiftyWang/FingerColoring-Android
@Override
public void onClick(View view) {
if (view.getId() == border1.getId()) {
border1.setBackgroundResource(R.drawable.maincolor_border_bg);
drawableid = 1;
border2.setBackgroundResource(0);
} else {
border2.setBackgroundResource(R.drawable.maincolor_border_bg);
drawableid = 2;
border1.setBackgroundResource(0);
}
}
};
代码示例来源:origin: stackoverflow.com
ImageView img1=(ImageView) findViewById(R.id.imageview);
ImageView img2=(ImageView) findViewById(R.id.imageview);
RelativeLayout.LayoutParams lp2=new RelativeLayout.LayoutParams(100, 100);
lp2.addRule(RelativeLayout.ALIGN_RIGHT,img2.getId());
img1.setLayoutParams(lp2);
代码示例来源:origin: stackoverflow.com
public void addEastImageView(RelativeLayout myBackgroundLayout, ImageView center, ImageView east, int leftPadding, int topPadding, int rightPadding, int bottomPadding){
RelativeLayout.LayoutParams rightSide = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
rightSide.addRule(RelativeLayout.RIGHT_OF, center.getId());
east.setPadding(leftPadding, topPadding, rightPadding, bottomPadding);
myBackgroundLayout.addView(east, rightSide);
}
代码示例来源:origin: stackoverflow.com
RelativeLayout layout=new RelativeLayout(context);
ImageView imageView = new ImageView(context);
imageView.setId(R.id.imageViewID);
RelativeLayout.LayoutParams layoutParams = new LayoutParams(50, 50);
layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
layout.addView(imageView, layoutParams);
TextView textView = new TextView(context);
RelativeLayout.LayoutParams textViewParams= new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
textViewParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
textViewParams.addRule(RelativeLayout.BELOW, imageView.getId());
layout.addView(nameView, nameLayoutParams);
代码示例来源:origin: HuanTanSheng/EasyPhotos
private void toggleIvMenu(@IdRes int resId) {
for (ImageView ivMenu : ivMenus) {
if (ivMenu.getId() == resId) {
ivMenu.setColorFilter(ContextCompat.getColor(this, R.color.easy_photos_fg_accent));
} else {
ivMenu.clearColorFilter();
}
}
}
代码示例来源:origin: stackoverflow.com
TextView tv;
ImageView iv;
View.OnClickListener myOnlyhandler = new View.OnClickListener() {
public void onClick(View v) {
if( tv.getId() == ((TextView)v).getId() ){
// it was the textview
}
else if(iv.getId() == ((ImageView)v).getId() ){
// it was the imageview
}
}
}
代码示例来源:origin: adolfAn/FBReader_AS
@Override
public void onClick(View v) {
doSwitchViewType();
if(mViewFoldersView.getId() == R.drawable.afc_selector_button_folders_view_list){
mViewFoldersView.setImageDrawable(getResources().getDrawable(R.drawable.afc_selector_button_folders_view_grid));
mViewFoldersView.setId(R.drawable.afc_selector_button_folders_view_grid);
}else{
mViewFoldersView.setImageDrawable(getResources().getDrawable(R.drawable.afc_selector_button_folders_view_list));
mViewFoldersView.setId(R.drawable.afc_selector_button_folders_view_list);
}
}
};// mBtnFoldersViewOnClickListener
代码示例来源:origin: omadahealth/SlidePager
/**
* Init the {@link android.graphics.Color} of the {@link #mChartBarList}
*/
private void initBarColorsAndSize() {
for (ImageView imageView : mChartBarList) {
imageView.setBackgroundColor(mChartBarColor);
if (imageView.getId() != R.id.progress_bottom_axis) {
imageView.setMinimumHeight((int) (mChartBarSize / 2.0f));
}
}
}
代码示例来源:origin: stackoverflow.com
ConstraintLayout layout = (ConstraintLayout)fndViewById(R.id.mainConstraint);
ConstraintSet set = new ConstraintSet();
ImageView view = new ImageView(this);
layout.addView(view,0);
set.clone(layout);
set.connect(view.getId(), ConstraintSet.TOP, layout.getId(), ConstraintSet.TOP, 60);
set.applyTo(layout);
内容来源于网络,如有侵权,请联系作者删除!