Coder Social home page Coder Social logo

butterknife_demo's Introduction

ButterKnife_demo

自定义实现ButterKnife功能 注解反射动态代理

使用方式

@ContentView(R.layout.activity_main) public class MainActivity extends BaseActivity

@BindId(R.id.tv_hello) private TextView tv_hello;

@Onclick({R.id.tv_hello}) public void onClick(View view){

自定义注解 ContentView 反射注入布局

自定义注解 BindId 反射注入控件id 并赋值给属性

自定义注解Onclick 并给注解设置Bean 监听方法,监听的类的类型,监听的回调方法 通过反射给onclick方法传入此三个值 用动态代理 切面view的onclcik 方法替换自己写的click方法 动态代理还实现了 多次点击的全局拦截.

原理 是反射实现注入 动态代理实现拦截切面方法替换 全局拦截

butterknife_demo's People

Contributors

fanchaolve avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

shuweitao

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.