安卓:图像在图像图像

2023-09-04 03:57:30 作者:无视沵的存在

我有一个视频缩略图,当你点击它,在视频开始在YouTube播放器播放。这个伟大的工程,但它不是那么清楚,你必须点击缩略图玩,所以我有我想提请多年来在右下角的缩略图播放按钮图像。我怎么会去吗?我现在有缩略图中的可绘制对象,并在我的绘制资源目录中的播放按钮。我想的东西用位图和帆布,但它会很困难,我不知道这是不是要走的路。

I have a video thumbnail and when you click on it, the video starts playing in the YouTube player. This works great, but It's not so clear that you have to click on the thumbnail to play, so I have a play button image that I want to draw over the thumbnail in the bottom right corner. How would I go about this? I currently have the thumbnail in a Drawable object and the play button in my drawable resource directory. I tried stuff with bitmaps and canvas but it's quite hard and I don't know if this is the way to go.

非常感谢! 埃里克

推荐答案

使用相对或的FrameLayout:

Use Relative or FrameLayout:

<RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
    <ImageView  android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/thumbnail"/>
    <ImageView  android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/play" android:layout_alignParentBottom="true" android:layout_alignParentRight="true"/>
</RelativeLayout>

<FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content">
    <ImageView  android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/thumbnail"/>
    <ImageView  android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/play" android:layout_gravity="bottom|right"/>
</FrameLayout>