【发布时间】:2018-03-23 05:27:16
【问题描述】:
我想在播放时以圆形视图裁剪 youtube 视频。我怎样才能做到这一点?我尝试过将其嵌入到线性布局中,然后将布局的背景设置为圆形,但在这种情况下,youtube 播放器视图仍保持矩形形状。
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/circle"
android:gravity="center"
>
<com.google.android.youtube.player.YouTubePlayerView
android:id="@+id/youtube_view"
android:layout_width="150dp"
android:layout_height="150dp"
/>
</LinearLayout>
和背景文件
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="#666666"/>
<size
android:width="200dp"
android:height="200dp"/>
</shape>
【问题讨论】:
-
或许您应该向我们展示您的尝试?
-
@NiamatullahBakhshi 请检查我是否已编辑问题
-
你是不是错过了关闭
shape标签? -
@NiamatullahBakhshi 我已经在我的代码中做到了
-
youtube playview 高度宽度设置为 match-parent 和 padding 10dp。然后检查一下
标签: android view android-custom-view youtube-data-api custom-view