我浏览过并尝试过如何将录制的视频显示到ImageView而没有成功的多个建议.
此代码适用于拍摄图像并显示图像.视频也会被录制并保存到手机中,但不会显示在ImageView中.有关如何修改我的代码以使视频出现在ImageView中的任何建议?
除了:RESULT_LOAD_VID部分之外,一切似乎都能正常工作,它应该将选定或录制的视频显示到ImageView.
我收到的错误是:"SkImageDecoder :: Factory返回null"
据我所知,这意味着无论出于何种原因,所选/录制的视频位置都没有传递到RESULT_LOAD_VID部分.
任何帮助表示赞赏.
这是我目前的代码:
public class Media extends AppCompatActivity{
private static int RESULT_LOAD_IMG = 1;
private static int RESULT_LOAD_VID = 1;
String imgDecodableString;
private String selectedImagePath = "";
private static final int CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE = 200;
final private int CAPTURE_IMAGE = 2;
private Uri fileUri;
private ImageView mImageView;
Toolbar toolbar;
private String imgPath;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.toolbarmedia, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) …Run Code Online (Sandbox Code Playgroud)我一直在寻找解决这个问题的一段时间没有成功.我的AppBarLayout与我的一个xml文件中的RecyclerView重叠.我尝试重新排列视图而没有任何积极的结果.任何帮助表示赞赏.这是我的代码:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@color/bg_register">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/toolbar"/>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/x"/>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="@menu/activity_main_drawer"
android:clickable="true"/>
</android.support.v4.widget.DrawerLayout>Run Code Online (Sandbox Code Playgroud)
这是内容的xml文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:orientation="vertical"
android:background="@color/bg_register"
android:paddingLeft="10dp"
android:paddingRight="10dp"
tools:showIn="@layout/activity">
<TextView
android:padding="5dp"
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/list" />
<android.support.v7.widget.RecyclerView
android:layout_below="@id/textView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/lv_recycler"
android:background="@color/white"
android:scrollbars="vertical"
android:clickable="true"
android:fadeScrollbars="true"/>
</RelativeLayout>Run Code Online (Sandbox Code Playgroud)
android android-layout android-recyclerview android-appbarlayout