Example usage for android.widget ImageView ImageView

List of usage examples for android.widget ImageView ImageView

Introduction

In this page you can find the example usage for android.widget ImageView ImageView.

Prototype

public ImageView(Context context) 

Source Link

Usage

From source file:com.linkbubble.ui.ContentViewButton.java

public ContentViewButton(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    setOnTouchListener(mButtonOnTouchListener);

    mImageView = new ImageView(context);
    mImageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(mImageView);//from w  w w.  j  ava 2 s . c o  m
}

From source file:com.connectsdk.smarthomesampler.dialog.HueFragmentDialog.java

@NonNull
@Override//from www .j av  a  2 s .c o  m
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Context context = getActivity();
    final ImageView image = new ImageView(getActivity());
    image.setAdjustViewBounds(true);
    image.setImageResource(R.drawable.press_smartbridge);

    return new AlertDialog.Builder(context).setTitle(R.string.press_hue_button).setView(image)
            .setCancelable(true).create();
}

From source file:cn.trinea.android.demo.adapter.ImagePagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    ImageView imageView = new ImageView(context);
    imageView.setImageResource(imageIdList.get(position));
    ((ViewPager) container).addView(imageView, 0);
    return imageView;
}

From source file:com.xxjwd.adapter.ImagePagerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    ImageView imageView = new ImageView(context);
    imageView.setImageBitmap(imageList.get(position));
    ((ViewPager)container).addView(imageView, 0);
    return imageView;
}

From source file:dev.vision.shopping.center.Splash.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ImageView iv = new ImageView(this);
    Animation mLoadAnimation = AnimationUtils.loadAnimation(getApplicationContext(), android.R.anim.fade_in);
    mLoadAnimation.setDuration(2500);//from w w  w. j a v a  2 s .  com
    iv.setImageResource(R.drawable.myapp_loading);

    mLoadAnimation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            new Handler().postDelayed(new Runnable() {

                @SuppressLint("NewApi")
                @Override
                public void run() {
                    Intent i = new Intent(Splash.this, CustomZoomAnimation.class);
                    if (LICENSE.isValid("10/07/2015", Splash.this)) {
                        startActivity(i);
                        finish();
                    }
                }
            }, 2000);
        }
    });

    iv.setAnimation(mLoadAnimation);

    setContentView(iv);

}

From source file:com.yanzhenjie.nohttp.sample.adapter.MainBannerAdapter.java

@Override
public Object instantiateItem(ViewGroup container, int position) {
    ImageView imageView = new ImageView(container.getContext());
    imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
    imageView.setImageResource(IMAGES[position % IMAGES.length]);
    container.addView(imageView);//w  w  w. j ava 2  s  .  c o  m
    return imageView;
}

From source file:it.gulch.linuxday.android.fragments.RoomImageDialogFragment.java

@NonNull
@Override/* w  w  w .  j a  va2s.  c om*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Bundle args = getArguments();

    ImageView imageView = new ImageView(getActivity());
    imageView.setImageResource(args.getInt("imageResId"));

    Dialog dialog = new AlertDialog.Builder(getActivity()).setTitle(args.getString("roomName"))
            .setView(imageView).create();
    dialog.getWindow().getAttributes().windowAnimations = R.style.RoomImageDialogAnimations;
    return dialog;
}

From source file:galilei.kelimekavanozu.view.ImageAdapter.java

@Override
public Object instantiateItem(ViewGroup container, final int position) {
    if (context.get() != null) {
        final int drawableId = theme.getImageList().get(position + 1);
        final ImageView view = new ImageView(context.get());
        view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        view.setContentDescription(context.get().getResources().getString(R.string.content_desc_poempic));
        view.setScaleType(ImageView.ScaleType.CENTER_CROP);
        view.setAdjustViewBounds(true);/*from w ww  .  j a  v a  2  s.c  om*/
        view.setTag(drawableId);
        container.addView(view, 0);
        view.post(new Runnable() {
            @Override
            public void run() {
                ImageLoader.getImageLoader().load(drawableId, view);
            }
        });
        return view;
    }
    return null;
}

From source file:com.yojiokisoft.yumekanow.adapter.BackImagePagerAdapter.java

/**
 * @see PagerAdapter#instantiateItem(ViewGroup, int)
 *//*  w  w w. j a v  a2  s. c o m*/
@Override
public Object instantiateItem(ViewGroup container, int position) {
    mImageView = new ImageView(mContext);
    mImageView.setPadding(0, 5, 0, 0);
    mImageView.setBackgroundColor(0xFF000000);
    mImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);

    BackImageEntity item = mList.get(position);
    MyImage.setImage(mImageView, item);

    // ?
    container.addView(mImageView);

    return mImageView;
}

From source file:com.example.nikhil.wikipediasearch.ImageAdapter.java

public View getView(int position, View view, ViewGroup parent) {
    if (view == null) {
        view = new ImageView(parent.getContext());
        view.setPadding(6, 2, 6, 2);//  ww  w .  j av  a  2  s . co  m
        //view.getBackground().setColorFilter(Color.parseColor("#00ff00"), PorterDuff.Mode.DARKEN);
        view.setBackgroundColor(ContextCompat.getColor(parent.getContext(), R.color.Color_1));

        view.invalidate();
    }

    int width = parent.getContext().getResources().getDisplayMetrics().widthPixels;
    if (URLS[position] != null) {
        Picasso.with(parent.getContext()).load(URLS[position]).noFade().resize(width / 4, width / 4)
                .centerCrop().error(R.drawable.no_image).placeholder(R.drawable.loading_image)
                .into((ImageView) view);
    }

    view.setTag(position);

    view.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                int pos = (int) v.getTag();
                zoomImageFromThumb(v, pos);

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });

    return view;
}