我正在使用文件提供程序将照片保存到给定目的地.我明白了:
java.lang.IllegalArgumentException:尝试打开活动以从摄像头捕获图像时缺少android.support.FILE_PROVIDER_PATHS元数据.
我的manifest.xml文件:
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.example"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/paths" />
</provider>
Run Code Online (Sandbox Code Playgroud)
我的paths.xml文件:
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="content" path="Android/data/com.my_package_name/files/" />
</paths>
Run Code Online (Sandbox Code Playgroud)
和Java代码:
File externalFilesDirectory = this.getExternalFilesDir(null);
File imageFile = File.createTempFile(
imageFileName,
".jpg",
externalFilesDirectory
);
Uri photoURI = FileProvider.getUriForFile(this, "com.example", imageFile);
Run Code Online (Sandbox Code Playgroud)
最后一行给出了例外.我在这里错过了什么?我已经关注了官方Android开发网站的教程(https://developer.android.com/training/camera/photobasics.html)
android android-image android-xml android-file android-fileprovider
假设我们有功能:
template <typename Kind, typename... Kinds> void foo(){...};
Run Code Online (Sandbox Code Playgroud)
检查类型'Kind'是否是C++中类型'Kinds'之一(包括C++ 1z)的最简单方法是什么?
我在垂直方向使用带有StaggeredGridLayoutManager的RecyclerView.RecyclerView的项目只包含一个视图 - ImageView.我希望ImageView高度可以缩放以匹配RecyclerView的列宽并保持它包含的照片的宽高比.目前此图像视图的参数是:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
但RecyclerView中项目的高度与照片的原始高度匹配,而照片只是居中.怎么可能实现这一目标?
android imageview staggered-gridview staggeredgridlayout android-recyclerview