gpt4 book ai didi

java - 如何更改 Exomedia 的默认视频控制栏的颜色?

转载 作者:行者123 更新时间:2023-11-30 01:13:20 30 4
gpt4 key购买 nike

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:EMVideoView="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/MUVCastleRock">

<com.devbrackets.android.exomedia.ui.widget.EMVideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
EMVideoView:useDefaultControls="true" />

‍‍‍‍

如何更改默认控件的颜色(播放按钮所在的位置)?我不想更改视频背后的背景,而是更改播放栏。这是因为我的背景是灰色的,所以我想更改颜色以使条形更加可见。

编辑:enter image description here

最佳答案

@Shank 建议我替换/exomedia/ui/widget/VideoControls.java 中的按钮图像

尽管我并没有尝试更改这些按钮的图像,但分析此类得出了我的答案。

此类中有几个函数可以更改默认视频控件的设置。

您可以设置标题、描述、副标题、更改按钮图像(如 Shank 所建议的),并通过更改包含视频控件(名为 controlsContainer)的容器的特性来解决我的特定问题。

默认容器在 retrieveViews() 中由以下行初始化:

controlsContainer = (ViewGroup) findViewById(R.id.exomedia_controls_interactive_container);

使用它,我只需从我的 EMVideoView 中调用这个引用并适本地更改颜色:

emVideoView = (EMVideoView) myView.findViewById(R.id.video_view);
ViewGroup textContainer = (ViewGroup) emVideoView.findViewById(R.id.exomedia_controls_interactive_container);
textContainer.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.myColor));

我发现的其他有用方法如下:

emVideoView.getVideoControls().setTitle("title");
emVideoView.getVideoControls().setDescription("description");
emVideoView.getVideoControls().setSubTitle("sub");
emVideoView.getVideoControls().setPlayPauseImages(R.drawable.logo,R.mipmap.ic_launcher);

关于java - 如何更改 Exomedia 的默认视频控制栏的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38208044/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com