Android programming implements the method of displaying only part of the picture

This example describes the method of Android programming to display only part of the picture. Share with you for your reference, as follows:

It is very easy to load a picture in the Android application and display it. How can you display a small part of a picture? One way is to PS the picture, save the part to be displayed as a picture, and then load it in the program and display it. But this will increase the number of pictures in the program. For a complete picture, it is also very simple to cut the part you want with a program.

The following program is to load a picture, then fill the picture into the whole screen of the mobile phone through transformation, and then display the 100 * 100 part in the middle of the picture in the middle of the screen.

Showpositionpictureactivity Code:

Create a new poritionview class code:

Add a picture gir in the RES / drawable project Png, the effect of running the program is to display only the middle 100 * 100 part of the picture.

More readers interested in Android related content can view the special topics of this site: summary of Android graphics and image processing skills, introduction and advanced tutorial of Android development, summary of Android debugging skills and solutions to common problems, summary of Android multimedia operation skills (audio, video, recording, etc.), summary of Android basic component usage Summary of Android view skills, summary of Android layout skills and summary of Android control usage

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>