首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >colorFilter在图像上的应用

colorFilter在图像上的应用
EN

Stack Overflow用户
提问于 2016-09-29 14:02:06
回答 1查看 44关注 0票数 0

这可能是个愚蠢的问题,但我已经找了几个小时了,但没有得出任何结论,我应该怎么做。

有一个黑暗过滤器,适用于一些网站和应用程序图像上的图像。我的问题是,我应该如何生成这个过滤器,并在运行时将其应用于图像。我知道这与使用setColorFilter有某种关系,但我不确定如何使用。如果有人能把我引向正确的方向,那就是我所需要的。谢谢

示例图像过滤器:

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-29 14:15:34

这是我用来做这件事的样本。

代码语言:javascript
复制
<RelativeLayout
        android:clickable="true"
        android:foreground="?attr/selectableItemBackground"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <!-- Here, you can implement your own imageview as you want -->
        <my.package.ui.widget.ScaleImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="matrix"
            android:adjustViewBounds="true"
            app:error="@{@drawable/image_broken}"
            app:imageUrl="@{item.imageUrl}"
            app:placeholder="@{@drawable/image_holder}" />

        <View
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#30000000" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginBottom="40dp"
            android:ellipsize="end"
            android:lines="1"
            android:shadowColor="#111"
            android:shadowDx="1"
            android:shadowDy="1"
            android:shadowRadius="1"
            android:text="@{item.title}"
            android:textColor="#fff"
            style="@style/TextAppearance.AppCompat.Title"
            tools:text="It's Image Caption" />

    </RelativeLayout>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39772495

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档