GithubHelp home page GithubHelp logo

ioc_di's Introduction

IOC_DI

经典的IOC应用 利用反射,注解 注入视图,控件,以及绑定事件

实现思路 1:在BaseActivity 的OnCreate中实现注入 view activity event 2:通过反射获取类上的注解,获取注解中的视图id,通过反射拿到setContentView 然后调用实现注入视图 3:通过反射获取所有属性,如果包含注入控件的注解,就反射拿到findViewById,然后注入控件 4:绑定事件 1:反射获取activity所有方法 2:如果有能拿到我们设置多态的注解,就说明这是一个事件的注解 3:然后通过反射方法拿到控件id数组 4:反射获取所有view 5:动态代理事件 listener 调用activity的事件方法 6: 反射调用设置事件监听的方法 完成

ioc_di's People

Contributors

slinkf avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.