code to display image with text on Background image in android

imagView=(ImageView)findViewById(R.id.imageView1);
       // Bitmap src = BitmapFactory.decodeFile("drawable/androidfather_andy_rubin.jpg");
       // Bitmap scaled = Bitmap.createScaledBitmap(src, 40, 40, true);
        Bitmap mBitmapImage = BitmapFactory.decodeResource(getResources(), R.drawable.androidfather_andy_rubin);
        Bitmap mBitmapBackgrndImage = BitmapFactory.decodeResource(getResources(), R.drawable.aqua_nine_patch_image);
               
                int backImg_width  = mBitmapBackgrndImage.getWidth();
                int backImg_height = mBitmapBackgrndImage.getHeight();
                int Img_width  = backImg_width-70;///mBitmapImage.getWidth();
                int Img_height = backImg_height-70;//mBitmapImage.getHeight();
                Bitmap bmOverlay = Bitmap.createScaledBitmap(mBitmapImage, Img_width, Img_height, true);
                Bitmap bmBackgroundOverlay = Bitmap.createScaledBitmap(mBitmapBackgrndImage, backImg_width, backImg_height, true);
                //Bitmap bmOverlay = Bitmap.createBitmap(Img_width,Img_height, mBitmapImage.getConfig());
                // Bitmap bm = ShrinkBitmap("drawable/androidfather_andy_rubin.jpg", Img_width, Img_height);
                imagView.setBackgroundResource(R.drawable.aqua_nine_patch_image);
                imagView.setImageBitmap(bmOverlay);

Comments

  1. Hi Pavan

    Awesome post yar..
    Its really saved my day..

    ReplyDelete

Post a Comment

Popular posts from this blog

Custom Dialog with no title and full screen in Android

Best working code to set Date limits on Date Picker Dialog,in Android

code to display .pdf,.text,.DOC,.DOCX,.doc extension files exists in SDCard