GithubHelp home page GithubHelp logo

pressimageview's Introduction

PressImageView

自带按下效果的 ImageView。为什么会有这个东西呢?解决两个问题。

  1. 网络图片没有按下效果的配图 通常我们实现 view 的按下效果是通过 selector 这是 background 实现的,但如果是 ImageView 的话,就需要两个图片,一个正常状态,一个按下状态,本地的资源图片还好,如果是网络图片,这种方式就没办法做了,于是有了这个自定义 ImageView。

  2. 只改变 ImageView 的 src 按下效果 有些图片是不规则的,通过改透明度的方法修改的是整个 ImageView 的按下效果,这样不是很好。

Preview

PressImageView.gif

Usage

<me.bakumon.library.pressimageview.PressImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/press_imageview"
        app:pressColorBrightness="0.85"
        android:clickable="true"
        android:src="@drawable/image" />
xml 属性 说明
pressColorBrightness 0~2之间的浮点数,0最暗,1无效果,2最亮
java 方法 说明
setPressColorBrightness(float pressBrightness) 0~2之间的浮点数,0最暗,1无效果,2最亮

TODO

  • Ripple 效果
  • 图标跳动效果
  • 缩放效果

License

MIT

pressimageview's People

Contributors

bakumon avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.