當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。