我有一个视频缩略图,当你点击它时,视频开始在YouTube播放器中播放。
这是有效的,但不清楚你必须点击缩略图才能播放,因此,我想在右下角的缩略图上绘制一个播放按钮图像。我该怎么做呢?
我目前在可绘制的对象中有缩略图,在可绘制的资源目录中有播放按钮。
我尝试了位图和画布的东西,但这是相当困难的,我不知道这是不是可行的方法。
发布于 2010-09-03 17:36:27
使用Relative或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>发布于 2010-09-03 17:35:23
如果使用FrameLayout或RelativeLayout来堆叠视图呢?
下面是一些psaudo代码:
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.yourpackage.VideoPlayer
android:layout_width="fill_parent"
android:layout_height="fill_parent"
></VideoPlayer>
<!-- Adjust the layout position of the button with gravity, margins etc... -->
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="Play"
/>
</FrameLayout>发布于 2017-03-10 22:40:50
我使用了RelativeLayout,它对我很有效
<RelativeLayout
android:id="@+id/image_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:clickable="true"
android:layout_gravity="top"
android:maxHeight="400dp"/>
<ImageView
android:id="@+id/play"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_menu_play_large"
android:layout_centerInParent="true" />
</RelativeLayout>https://stackoverflow.com/questions/3634496
复制相似问题