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


Java ImageView.getId方法代码示例

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


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

示例1: showToast

import android.widget.ImageView; //导入方法依赖的package包/类
private void showToast(ImageView btn) {
    if (toast != null) {
        toast.cancel();
    }
    String text = "Clicked: " + btn.getId();
    toast = Toast.makeText(this, text, Toast.LENGTH_SHORT);
    toast.show();

}
 
开发者ID:xzg8023,项目名称:ArcLayout-master,代码行数:10,代码来源:MainActivity.java

示例2: onLongClick

import android.widget.ImageView; //导入方法依赖的package包/类
@OnLongClick({R.id.student, R.id.lecturer})
boolean onLongClick(ImageView imageView) {
    switch (imageView.getId()) {
        case R.id.student:
            Toast.makeText(this, "Student", Toast.LENGTH_SHORT).show();
            break;
        case R.id.lecturer:
            Toast.makeText(this, "Lecturer", Toast.LENGTH_SHORT).show();
            break;
    }
    return true;
}
 
开发者ID:rumaan,项目名称:AcademApp,代码行数:13,代码来源:ChooseTypeActivity.java

示例3: onClick

import android.widget.ImageView; //导入方法依赖的package包/类
@OnClick({R.id.student, R.id.lecturer})
void onClick(ImageView imageView) {
    switch (imageView.getId()) {
        case R.id.student:

            if (studentTickImage.getVisibility() != View.VISIBLE) {
                chosenType = 0;
                studentTickImage.setVisibility(View.VISIBLE);
                MaterialIn.animate(studentTickImage, Gravity.TOP, Gravity.TOP);

                lecturerTickImage.setVisibility(View.INVISIBLE);
                animateButton("Student");
            }
            break;
        case R.id.lecturer:
            // chosen lecturer
            if (lecturerTickImage.getVisibility() != View.VISIBLE) {
                chosenType = 1;
                studentTickImage.setVisibility(View.INVISIBLE);

                lecturerTickImage.setVisibility(View.VISIBLE);
                MaterialIn.animate(lecturerTickImage, Gravity.TOP, Gravity.TOP);

                animateButton("Lecturer");
            }
            break;
    }
}
 
开发者ID:rumaan,项目名称:AcademApp,代码行数:29,代码来源:ChooseTypeActivity.java

示例4: setViewImage

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void setViewImage(ImageView view, String value) {
    if (view.getId() == R.id.liCallIcon) {
        switch (Integer.parseInt (value)) {
            case Calls.INCOMING_TYPE :
                view.setImageResource(R.drawable.ic_recived);
                break;
            case Calls.OUTGOING_TYPE :
                view.setImageResource(R.drawable.ic_made);
                break;
            case Calls.MISSED_TYPE :
                view.setImageResource(R.drawable.ic_missed);
                break;
            case Calls.REJECTED_TYPE :
                view.setImageResource(R.drawable.ic_rejected);
                break;
        }
        Log.d("APPTEST", value);
    }
}
 
开发者ID:gothalo,项目名称:Android-2017,代码行数:21,代码来源:CallLogAdapter.java

示例5: onCreate

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    ButterKnife.bind(this);
    final AnimatedViewPager pager= ButterKnife.findById(this,R.id.pager);
    final ImageView background=ButterKnife.findById(this,R.id.scrolling_background);
    int[] screenSize=screenSize();

    for(ImageView element:sharedElements){
        @ColorRes int color=element.getId()!=R.id.logo?R.color.white_transparent:R.color.color_logo_log_in;
        DrawableCompat.setTint(element.getDrawable(), ContextCompat.getColor(this,color));
    }
    //load a very big image and resize it, so it fits our needs
    Glide.with(this)
            .load(R.drawable.busy)
            .asBitmap()
            .override(screenSize[0]*2,screenSize[1])
            .diskCacheStrategy(DiskCacheStrategy.RESULT)
            .into(new ImageViewTarget<Bitmap>(background) {
                @Override
                protected void setResource(Bitmap resource) {
                    background.setImageBitmap(resource);
                    background.post(()->{
                        //we need to scroll to the very left edge of the image
                        //fire the scale animation
                        background.scrollTo(-background.getWidth()/2,0);
                        ObjectAnimator xAnimator=ObjectAnimator.ofFloat(background,View.SCALE_X,4f,background.getScaleX());
                        ObjectAnimator yAnimator=ObjectAnimator.ofFloat(background,View.SCALE_Y,4f,background.getScaleY());
                        AnimatorSet set=new AnimatorSet();
                        set.playTogether(xAnimator,yAnimator);
                        set.setDuration(getResources().getInteger(R.integer.duration));
                        set.start();
                    });
                    pager.post(()->{
                        AuthAdapter adapter = new AuthAdapter(getSupportFragmentManager(), pager, background, sharedElements);
                        pager.setAdapter(adapter);
                    });
                }
            });
}
 
开发者ID:vpaliyX,项目名称:LoginConcept,代码行数:42,代码来源:LoginActivity.java


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