ConstraintLayout (二)

2026-02-02  本文已影响0人  雨来

ImageFilterView和 ImageFilterButton

两个属性
    app:roundPercent="0.98" //取值0-1
    app:round="30dp"  //优先级大于 roundPercent

但 ImageFilterButton的效果大打折扣,它有范围限制,你把 round设置成无限大,也它不会成个圆形,但 ImageFilterViewt则不一样可能看着像个圆形

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".activity.ConstraintLayoutAct">

    <androidx.constraintlayout.utils.widget.ImageFilterView
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginTop="30dp"
        android:background="#aa0000"
        app:roundPercent="0.98"
        app:round="30dp"
        android:layout_width="80dp"
        android:layout_height= "80dp"/>


</androidx.constraintlayout.widget.ConstraintLayout>

效果


image.png
交叉淡化效果
image.png
image.png
调整亮度
image.png
image.png
image.png
调节色温:


image.png

正常:原图:


image.png
热:
image.png
饱和度
image.png

原图:


image.png

饱和度加大


image.png
对比度:
image.png

原图:


image.png

对比度加大


image.png
注意:

app:blendSrc="@drawable/shape_blend_src_drawable" 这个属性是无用的,可以在xml中写出 但无用,在源码中可以求证 并没有设置此drawable的方法,所以不要浪费时间在上面了。

这个也可以参考一下:
https://blog.csdn.net/u013700502/article/details/142737720

上一篇 下一篇

猜你喜欢

热点阅读