#7 #342 提交实验7 通过拍照或相册获取图片实现用户头像更换 #1621
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
该功能作为“个人中心”其中的头像更换:
由于android版本的提高,现在实现相机功能需要在AndroidManifest.xml里面声明权限还要配置provider
遇到问题的总结:
1.AndroidManifest.xml里的android:authorities要和HeadActivity.java里的FileProvider.getUriForFile一样
2.要声明相机权限和sd卡权限
运行截图:








1.点击第一个button控件:
2.选择拍照启动系统照相机:
3.拍完启动截图功能:
4.imageview控件图片更改:
5.再次点击第一个button,选择相册获取:
6.选择图片:
7.进行截图:
8.截图完成imageview控件再次更改图片: