---
title: "android和ios button点击变暗效果"
author: "xushans"
date: "2015-03-24T20:35:24Z"
tags: ["Android", "iOS"]
categories: ["移动开发"]
slug: "android-ios-button"
draft: false
lastmod: "2015-03-24T20:35:24Z"
id: 2195212
url: "https://xushans.iteye.com/blog/2195212"
---

button点击时，需要变暗效果。

ios:
只需要check该元素的highlighted adjusts image的属性

android:
设置该控件的颜色滤镜
按下时：

```java

drawable.setColorFilter(Color.GRAY,PorterDuff.Mode.MULTIPLY);

```


弹起时：

```java

drawable.clearColorFilter();

```