小编Pan*_*egi的帖子

如何在Android中以编程方式设置矢量drawable的fillColor,StrokeWidth和StrokeColor

我已经搜索了很多关于改变矢量drawable的fillColor,strokeColor和strokeWidth但没有找到任何东西的搜索.

这是矢量drawable:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="300"
android:viewportHeight="300"
android:width="300dp"
android:height="300dp">
<path
    android:pathData="M150.412,10.422999999999973,C227.47,10.422999999999973,289.93100000000004,72.81,289.93100000000004,149.771,C289.93100000000004,226.73,227.47,289.119,150.412,289.119,C73.36,289.119,10.893,226.73,10.893,149.771,C10.893,72.81,73.36,10.422999999999973,150.412,10.422999999999973z"
    android:strokeLineJoin="round"
    android:strokeWidth="4"
    android:fillColor="#00000000"
    android:strokeColor="#010101"
    android:strokeMiterLimit="10" />
Run Code Online (Sandbox Code Playgroud)

如果我想使用Xml更改其FillColor,StrokeColor和StrokeWidth,那么代码将是以下代码:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="300"
android:viewportHeight="300"
android:width="300dp"
android:height="300dp">
<path
    android:pathData="M150.412,10.422999999999973,C227.47,10.422999999999973,289.93100000000004,72.81,289.93100000000004,149.771,C289.93100000000004,226.73,227.47,289.119,150.412,289.119,C73.36,289.119,10.893,226.73,10.893,149.771,C10.893,72.81,73.36,10.422999999999973,150.412,10.422999999999973z"
    android:strokeLineJoin="round"
    android:strokeWidth="10"
    android:fillColor="#f50d0d"
    android:strokeColor="#f1e904"
    android:strokeMiterLimit="10" />
Run Code Online (Sandbox Code Playgroud)

如何通过Java代码以编程方式实现此目的?

java android vector

5
推荐指数
0
解决办法
602
查看次数

如何在Exoplayer中为下一个,上一个,后退和前进添加侦听器

我正在使用ExoPlayer,我想自定义ExoPlayer并监听下一个,上一个,快退,快进的事件,以便当用户单击“下一步”按钮时,播放列表中的下一个视频以及使用上一个中的上一个视频时播放列表将被播放,依此类推。我正在使用自定义布局,它会更改设计,但不会监听这些事件(下一个,上一个等)。这是我的代码:-

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">


<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="200dp">

    <com.google.android.exoplayer2.ui.SimpleExoPlayerView
        android:id="@+id/player_view"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        app:resize_mode="fill"
        app:controller_layout_id="@layout/custom_controls"
        app:player_layout_id="@layout/custom_player_view"
        app:surface_type="texture_view"/>

    <ProgressBar
        android:id="@+id/progressBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:visibility="gone"/>
</RelativeLayout>




<android.support.v7.widget.RecyclerView
    android:id="@+id/recycler_view"
    android:layout_marginTop="220dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
Run Code Online (Sandbox Code Playgroud)

我在ConcatenatingMediaSource中添加了Mediasource列表。它正在工作,但我也要更改布局,这就是为什么我需要ExoPlayer中每个控件的侦听器的原因。我看到这个 链接。因此,我知道每次用户单击ExoPlayer中的下一个,上一个,快退,前进按钮时,都会调用onPositionDiscontinuity()方法,但是我希望每个按钮都具有侦听器,以便执行适当的操作?

谢谢

controls android listener exoplayer

5
推荐指数
1
解决办法
4888
查看次数

标签 统计

android ×2

controls ×1

exoplayer ×1

java ×1

listener ×1

vector ×1