GithubHelp home page GithubHelp logo

android-stupid-adapter's People

Contributors

comcp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

android-stupid-adapter's Issues

提几个建议

提出几点建议
ViewHolder也可以封装,考虑SparseArray,用成员变量存和用Map存本质上一样
adapter本身不必提供管理list的接口,完全没必要
OnItemClickListener建议废弃,容易出很多bug,直接在adapter里控制点击事件也不违背任何原则
convertView的复用封装起来了吗?没注意到

基本上这个库可以简化成两个类,并且二者除了基类不一样,其他都一样,对应ListView和Recyclerview的adapter

一个集合里要有多种不同的样式怎么办

extend XViewHolder<Bean>{

    @Override
        public void onResetView(Bean arg0, int arg1) {

             switch(arg0.getType()){

             case 1: 
             case 2:
             }
        }
    }
    我现在的做法是在Bean里加一个type字段,来进行区分,
    将所有可能的布局都写到一个xml里,用ViewStub 进行动态载入;
    或者是
    extend XViewHolder<Object>{

    @Override
        public void onResetView(Object arg0, int arg1) {

            if(arg0 instanceof String){

            }else if(arg0 instanceof Integer){

            }
        }



    }

item的点击事件

在 viewHolder里的onCreate里进行设置
将所有的点击事件的参数都传递为this,
这样就可以在外部的activity里进行操作.
参考demo里的模仿微信聊天界面哪里

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.