项目作者: jpardogo

项目描述 :
Android library to display a ListView whose cells are not rigid but flabby and react to ListView scroll.
高级语言: Java
项目地址: git://github.com/jpardogo/FlabbyListView.git
创建时间: 2014-03-22T11:47:56Z
项目社区:https://github.com/jpardogo/FlabbyListView

开源协议:Apache License 2.0

下载


FlabbyListView

This library is not maintained anymore and there will be no further releases

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.
And I also wrote a blog post about this library in my blog




Usage

1.Place the FlabbyListView on your layout:

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

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

  1. <!--Notice that this view extends from <FrameLayout></FrameLayout>.-->
  2. <com.jpardogo.android.flabbylistview.lib.FlabbyLayout
  3. xmlns:android="http://schemas.android.com/apk/res/android"
  4. xmlns:tools="http://schemas.android.com/apk/tools"
  5. android:layout_width="match_parent"
  6. android:layout_height="100dp"
  7. android:orientation="vertical">
  8. <!--Your content-->
  9. </FlabbyLayout>

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

  1. @Override
  2. public View getView(int position, View convertView, ViewGroup parent) {
  3. ViewHolder holder;
  4. if (convertView == null) {
  5. convertView = LayoutInflater.from(mContext).inflate(R.layout.item_list, parent, false);
  6. holder = new ViewHolder(convertView);
  7. convertView.setTag(holder);
  8. } else {
  9. holder = (ViewHolder) convertView.getTag();
  10. }
  11. int color = Color.argb(255, mRandomizer.nextInt(256), mRandomizer.nextInt(256), mRandomizer.nextInt(256));
  12. ((FlabbyLayout)convertView).setFlabbyColor(color);
  13. holder.text.setText(getItem(position));
  14. return convertView;
  15. }

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:

Maven Central

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

Notes

The iOS version developed by brocoo is available at BRFlabbyTable

Developed By

Javier Pardo de Santayana Gómez - jpardogo@gmail.com


Follow me on Twitter


Follow me on Google+


Follow me on LinkedIn

License

  1. Copyright 2013 Javier Pardo de Santayana Gómez
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.