这可能是个愚蠢的问题,但我已经找了几个小时了,但没有得出任何结论,我应该怎么做。
有一个黑暗过滤器,适用于一些网站和应用程序图像上的图像。我的问题是,我应该如何生成这个过滤器,并在运行时将其应用于图像。我知道这与使用setColorFilter有某种关系,但我不确定如何使用。如果有人能把我引向正确的方向,那就是我所需要的。谢谢
示例图像过滤器:

发布于 2016-09-29 14:15:34
这是我用来做这件事的样本。
<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>https://stackoverflow.com/questions/39772495
复制相似问题