user2253820
user2253820

Reputation: 1

Android, ImageView in message Balloon

It is interesting to find out how to add an image to the container(balloon) line in the list? full coverage of the region(balloon) (Android)

    __________
   |imageVeiw |
  /imageView  |
  \imageView  |
   |__________|

UPDATE:

I find solved. Result pic: http://i57.tinypic.com/dndok0.jpg

public void makeMaskImage(ImageView mImageView, int mContent)
    {
        Bitmap original = BitmapFactory.decodeResource(getResources(), mContent);
        Bitmap mask = BitmapFactory.decodeResource(getResources(),R.drawable.mask);
        int h = original.getHeight()/(original.getWidth()/mask.getWidth());
        original = Bitmap.createScaledBitmap(original, mask.getWidth(), h, false);

Bitmap result = Bitmap.createBitmap(mask.getWidth(), mask.getHeight(), Config.ARGB_8888); Canvas mCanvas = new Canvas(result); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN)); mCanvas.drawBitmap(original, 0, 0, null); mCanvas.drawBitmap(mask, 0, 0, paint); paint.setXfermode(null); mImageView.setImageBitmap(result); mImageView.setScaleType(ScaleType.CENTER); //mImageView.setBackgroundResource(R.drawable.frame); }

Upvotes: 0

Views: 563

Answers (1)

iffu
iffu

Reputation: 331

Convert your balloon image into ninepatch image using this(http://draw9patch.com/).while converting into 9patch set equal space in four side of image area. And also download and refer this tutorial(http://javapapers.com/android/android-chat-bubble/) for clear idea.

Upvotes: 0

Related Questions