Coder Social home page Coder Social logo

yllistview's Introduction

YLListView

YLListView仿IOS弹簧效果的ListView

使用方法

 compile 'com.a520wcf.yllistview:YLListView:1.0.1'

使用介绍:

布局:

<com.a520wcf.yllistview.YLListView
    android:divider="@android:color/transparent"
    android:id="@+id/listView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    />	

代码:

private YLListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    listView = (YLListView) findViewById(R.id.listView);
    // 不添加也有默认的头和底
    View topView=View.inflate(this,R.layout.top,null);
    listView.addHeaderView(topView);
    View bottomView=new View(getApplicationContext());
    listView.addFooterView(bottomView);

    // 顶部和底部也可以固定最终的高度 不固定就使用布局本身的高度
    listView.setFinalBottomHeight(100);
    listView.setFinalTopHeight(100);

    listView.setAdapter(new DemoAdapter());

    //YLListView默认有头和底  处理点击事件位置注意减去
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            position=position-listView.getHeaderViewsCount();
        }
    });


}

yllistview's People

Contributors

yll2wcf avatar

Watchers

hxkdyw 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.