将FrameLayout转换为视频?

时间:2018-08-11 07:58:08

标签: android view android-videoview android-framelayout

在我的Framelayout中,我有一个 ImageView和TextView ,并且能够使用以下代码段将FrameLayout转换为位图并保存它

Bitmap bitmap = Bitmap.createBitmap(frameLayout.getWidth(), frameLayout.getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        frameLayout.draw(canvas);
        try {
             FileOutputStream fileOutputStream = new FileOutputStream(Environment.getExternalStorageDirectory() + path));
            bitmap.compress(Bitmap.CompressFormat.PNG, 100, fileOutputStream); 
}

现在,我想使用VideoView实现相同的行为。因此,我还有一个带有 VideoView和TextView 的FrameLayout,我想将该FrameLayout转换为VideoView,以便将TextView合并到Video中。 我想知道是否有可能,欢迎任何想法。

编辑1:我的.xml内容

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<VideoView
    android:id="@+id/surface_camera"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
   />

<TextView
    android:id="@+id/buttonstart"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Username"
    android:textColor="@color/colorPrimary"
    android:textSize="20sp"
    android:textStyle="bold"
    android:layout_alignParentEnd="true"
    android:layout_alignParentRight="true" /></FrameLayout>

0 个答案:

没有答案
相关问题