Interception of Android bitmap and hiding and displaying of status bar

Getting to know bitmap

Bitmap is a final class, so it cannot be inherited. Bitmap has only one construction method, and the construction method is not modified by any access modifier, that is, the construction method is friendly, but Google says that the construction method of bitmap is private (private), which feels a little lax. Anyway, in general, we can't directly create a bitmap object through the construction method.

Bitmap is one of the most important classes in image processing in Android system. Bitmap can obtain image file information, cut, rotate, scale and compress the image, and save the image file in the specified format.

The text is as follows:

Recently, a function of sharing pictures was used in the project, so I recorded it. This method is a stupid method. If you have a better method, please give me more advice. Thank you here!

1. The interface to be shared in the project looks like this. You can see the status bar, title bar, parts to be shared in the middle and buttons at the bottom

2. The pictures that need to be shared look like this. The bottom status bar, title bar and bottom buttons are all hidden. Next, I will start the operation in the stupidest way

3. The first is the status bar

4. The title bar is also very simple. There are two main types here

The following method is used to inherit the activity

Inherit appcompatactivity and call getsupportactionbar(). Hide() on oncreate;

5. Just drop the button at the bottom

6. Now it's the middle screenshot

The above code means to obtain the mobile phone screen, enable the cache, and generate the bitmap through the cache

7. Process the bitmap fetched from the cache

It should be noted here that the corresponding width and height will be subtracted by how much the values of X and y are increased. After this operation, the effect in the second step will be obtained.

PS: let's take a look at the example code of Android display and hide status bar

Android shows and hides the status bar, which is used in the novel reading interface

summary

The above is what Xiaobian introduced to you about the interception of Android bitmap and the hiding and display function of the status bar. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

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
分享
二维码
< <上一篇
下一篇>>