Andoroid implements the dialog effect of selecting the bottom picture
1. The renderings are as follows:
Click to select photography, and the following selection dialog box will pop up:
2. Dialog implementation
layout
Height and color above, text:
Control selector
Dialog create
Add theme and dialog pop-up animation in the style file
Dialog creation
Dialig click event
@Override public void onClick(View view) { switch (view.getId()) { case R.id.abroad_choosephoto: pickAlbum(); break; case R.id.abroad_takephoto: takePhotos(); break; case R.id.abroad_choose_cancel: dialog.dismiss(); } dialog.dismiss(); }
3. Select a picture
Define event type
Pick pictures from album
Select a picture after taking a picture with your mobile phone
After the image is selected, the data will eventually be returned to the onactivityresult () method, so we need to rewrite this method in the activity
Cutting method
After taking photos, you need to save the data in a temporary file, and then obtain the file before cutting
4. Precautions
I didn't intend to cut it after choosing, but on Xiaomi 6 and other mobile phones, it's easy to crash without cutting. Another advantage of cutting is that we can do some business operations there after we get the bitmap, but we must remember to recycle the bitmap file, otherwise it will easily lead to memory leakage
summary
The above is what Xiaobian introduced to you. Andoroid realizes the bottom picture selection dialog effect. 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!