Code Monkey home page Code Monkey logo

flabbylistview's Introduction

FlabbyListView

Android library to display a ListView which cells are not rigid but flabby and react to ListView scroll and touch events.

A video example of this library is on this youtube video.
The demo app can be found on the play store.
And I also wrote a blog post about this library in my blog

Usage

1.Place the FlabbyListView on your layout:

    <com.jpardogo.android.flabbylistview.lib.FlabbyListView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

2.Populate it with items which xml layout is wrap by a FlabbyLayout:

    <!--Notice that this view extends from <FrameLayout/>.-->
    <com.jpardogo.android.flabbylistview.lib.FlabbyLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/apk/tools"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:orientation="vertical">

        <!--Your content-->

    </FlabbyLayout>

3.Set the color of each item. It needs to be set on the getView method of your adapter calling setFlabbyColor from FlabbyLayout:

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_list, parent, false);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        int color = Color.argb(255, mRandomizer.nextInt(256), mRandomizer.nextInt(256), mRandomizer.nextInt(256));
        ((FlabbyLayout)convertView).setFlabbyColor(color);
        holder.text.setText(getItem(position));
        return convertView;
    }

Including in your project

You can either add the library to your application as a library project or add the following dependency to your build.gradle:

dependencies {
    compile 'com.jpardogo.flabbylistview:library:(latest version)'
}

Notes

The iOS version developed by brocoo is available at BRFlabbyTable

Developed By

Javier Pardo de Santayana Gómez - [email protected]

Follow me on Twitter Follow me on Google+ Follow me on LinkedIn

License

Copyright 2013 Javier Pardo de Santayana Gómez

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

flabbylistview's People

Contributors

eveliotc avatar jpardogo avatar

Watchers

 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.