Android to achieve the zoom image flip function

package com.easyway.andorid.hello;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout.LayoutParams;

 * Android The zoom feature implemented pictures
 * @author longgangbai
 * @date 2010-5-24
 * @version 1.0
 * @since JDK6.0
public class ImageViewAndorid extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
         // The Setup program's title
         setTitle(" Scale and rotate pictures  ");
         // Instantiate an object of class LinearLayout  lly
         LinearLayout lly=new LinearLayout(this);
         // Gets a picture of the information here is  icon.png , The location of the pictures stored in the res/drawable under  ,
         // At the same time here also has a itfunz.bmp, this is the application's icon
         Bitmap bmpOrg=BitmapFactory.decodeResource(getResources(), R.drawable.icon);
         // Gets the size of the original picture
         int width=bmpOrg.getWidth();
         int height=bmpOrg.getHeight();

         int newWidth=400;
         int newheight=400;
         // Define the height and width of the scaled to the size of the
         float sw=((float)newWidth)/width;
         float sh=((float)newheight)/height;
         // Create a picture of the matrix object
         Matrix matrix=new Matrix();

         // Zoom pictures of action
         // Rotation  30*
         Bitmap resizeBitmap=Bitmap.createBitmap(bmpOrg,0,0,width,height,matrix,true);

         // Create a new picture
         BitmapDrawable bmp=new BitmapDrawable(resizeBitmap);

         // Create a Bitmap converted to  Drawable Object, so that it can be used in  ImageView And ImageButton in
         ImageView imageView=new ImageView(this);
         // Create ImageView object
         // The picture in the Middle
         // The picture fills the entire view
         lly.addView(imageView, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
         // Add to the layout template ImageView
分类:Mobile 时间:2010-05-25 人气:283
blog comments powered by Disqus


  • public void testStatementAddBatch () public void testConnCommit () 2011-09-01

    public void testStatementAddBatch() { Connection conn = null; Statement stmt = null; try { conn = getDBConnectionMsSqlBySuperAdmin(); stmt = conn.createStatement(); for(int i = 0; i < 100; i++) { String sql = " sql " + i; stmt.addBatch(sql);

  • C # Code Identification Class 2010-07-08

    using System; using System.Collections.Generic; using System.Text; using System.Collections; using System.Drawing; using System.Drawing.Imaging; using System.Runtime.InteropServices; namespace BallotAiying2 ...{ class UnCodebase ...{ public Bitmap bm

  • Identification of class C # Code 2010-07-08

    using System; using System.Collections.Generic; using System.Text; using System.Collections; using System.Drawing; using System.Drawing.Imaging; using System.Runtime.InteropServices; namespace BallotAiying2 ...{ class UnCodebase ...{ public Bitmap bm

  • 教你构建第一个Java Applet程序 2014-09-14

    本文的主要目的是创建一个简单的Java applet,需要的朋友可以参考下 介绍 Note: 在你开始本教程之前,你必须下载downloaded 并安装installed Java SE Development Kit. Java applets像Java应用程序一样,它们的建立都是遵循相同的三个步骤-编写,编译及运行.不同 的是,它们是在一部分网页上运行,而不是在你的桌面上运行. 本文的主要目的是创建一个简单的Java applet. 为了达到这一点要遵循以下三个基本步骤: 1. 在Java中

  • Thumbnail (universal) picture of the java class files can jpg.bmp.png.gif 2010-08-19

    Used to do the projects are enterprise applications for the first time the development of Gongneng News Forum image upload, upload image, the user need to be resolved in accordance with user-defined size Daxiao or in accordance with the picture Bili,

  • Picture tools, complete the picture of the interception, zoom (ImageHepler) 2010-11-12

    package com.lz.hr_picture.helper; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.imag

  • The Matrix class implements the use Android J2ME's drawRegion the image method 2010-04-07

    Achieved with Android J2ME in the drawRegion method, found on-line description of the image pixel array with flip all rows changed out to achieve, in fact this is the type of realization j2me, Android in Matrix class, if studied computer graphics, As

  • Image rotation. Flip. To zoom in and 2010-05-28

    Image rotation, flip, zoom in and out Actually rewrite paint (Graphics g) method drawImage (Image img, int x, int y, int width, int height, ImageObserver observer) Scaling picture only need to change the type of parameter can be a few int Class Graph

  • JAVA zoom image, image cut, change colors, change the type 2010-07-22

    import*; import java.awt.*; import java.awt.image.*; import java.awt.Graphics; import java.awt.color.ColorSpace; import javax.imageio.ImageIO; public class ImageCut { /** * Zoom Image * * @param srcImageFile * Address of the source image fil

  • Analytical design of java BMP file 2010-10-05

    First, the needs analysis: BMP is a hardware device-independent image file format, use very wide. BMP is the Windows environment, map-related data exchange and a standard in the Windows environment to run the graphic image software supports BMP image

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C), All Rights Reserved. 版权所有 黔ICP备15002463号-1

processed in 0.140 (s). 12 q(s)