【问题标题】:How do you change the clock icon color next to recent queries android你如何更改最近查询android旁边的时钟图标颜色
【发布时间】:2016-08-03 04:00:54
【问题描述】:

如何更改建议旁边的白色时钟的颜色?在屏幕截图中,最近的时钟显示在最左侧

【问题讨论】:

    标签: java android icons material-design


    【解决方案1】:

    Imageview 有一个名为 android:tint 的参数。

    定义你的ImageView 类似这样的东西

    <ImageView
        android:id="@+id/hist_image"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:tint="#colorcode"
        android:layout_centerVertical="true"
        android:layout_marginLeft="16dp"
        android:src="@drawable/search_last" />
    

    您也可以通过编程方式设置颜色。

    imageView.setColorFilter(getResources().getColor(R.color.blue),  
                                 android.graphics.PorterDuff.Mode.MULTIPLY);
    

    有关更多信息,请参阅this Documentation。我希望这将有所帮助。

    快乐编码。

    【讨论】:

    • 我会将 ImageView 放入哪个 XML 文件?我将为 imageView.setColorFilter 使用哪个 Java 文件?谢谢
    • 您用作列表项的xml。
    猜你喜欢
    • 1970-01-01
    • 2015-01-10
    • 2021-12-26
    • 1970-01-01
    • 2017-12-12
    • 2017-07-28
    • 1970-01-01
    • 1970-01-01
    • 2017-08-25
    相关资源
    最近更新 更多