本文实例为大家分享了Android实现滤镜效果的具体代码,供大家参考,具体内容如下
1.效果图

2.矩阵算法
3.布局
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <ImageView
- android:id="@+id/iv_photo"
- android:layout_width="300dp"
- android:layout_height="0dp"
- android:layout_weight="4"
- android:layout_gravity="center_horizontal"
- android:scaleType="fitCenter"
- android:src="@drawable/girl"
- />
-
- <GridLayout
- android:id="@+id/matrix_layout"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="2"
- android:columnCount="5"
- android:rowCount="4">
-
- </GridLayout>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <Button
- android:id="@+id/btn_change"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="change"/>
- <Button
- android:id="@+id/btn_reset"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="reset"/>
- </LinearLayout>
-
- </LinearLayout>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持w3xue。