3

私のアプリケーションでは、videoview を角を丸くして表示したいと考えています。丸みを帯びた角をlinearlayoutに設定して、linearlayout内にvideoview/surfaceviewを配置しようとしました。しかし、それは完全には機能しません。videoview/surfaceview に角丸を設定できません。ビューを下の画像のように設定したい: ここに画像の説明を入力

誰でもこれを行う方法を知っていますか?

4

9 に答える 9

1

FramLayout と XML ドローアブルを使用して作成できます

フレームレイアウト

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <VideoView
                android:layout_width="match_parent"
                android:layout_height="@dimen/dp_240"
                android:layout_margin="@dimen/dp_24"/>

            <View
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/rounded_corner_video_bg" />
        </FrameLayout>

XML ドローアブル

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <stroke
        android:width="@dimen/dp_24"
        android:color="@color/md_white_1000" />
    <corners android:radius="@dimen/dp_24" />
</shape>
于 2019-04-02T19:15:02.000 に答える
0

さまざまなビューを重ね合わせて、探している丸い角を作成してみてください。各コーナーの VideoView の上に 4 つの ImageView を配置して、目的の丸いコーナーを実現します。私はこれを達成するために RelativeLayout を使用して成功しましたが、FrameLayout を使用してビューをまとめることもできます。

于 2014-06-19T22:19:31.907 に答える
0

直接はできませんが、videoview の上に imageview を描画し、その間が透明で角が丸い無地の画像を設定することでこれを行うことができます。これを確認してください:ここをクリック

于 2015-10-09T12:57:38.847 に答える
-3

Create an xml file in drawable folder called shape_video.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
       <corners android:radius="6dp" />
 </shape>

Change the radius according to your rqmnt and in the background attribute of your videoview, give

android:background="@drawable/shape_video"
于 2013-06-17T13:00:30.973 に答える
-3

rounded.xml を drawable フォルダーに配置し、ビデオのフレームレイアウトに設定しますandroid:background="@drawable/rounded.xml"

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" android:padding="10dp">

    <solid android:color="#FFFFFFFF" />
    <corners android:radius="7dp" />

</shape>
于 2013-06-17T13:02:53.167 に答える