android 新闻标签 拖拽,DragDropListView

Travis master: DragDropListView.svg?branch=master

This project can help developers implement drag and drop effects quickly.

e17647781d88640957a440900dd704fd.gif

4f05557275740418afc241d972dfad47.gif

8d50c8e06afb0c987f1927bc6fcb5935.gif

Gradle

dependencies {

...

compile 'cc.solart:dragdrop:1.1.0'

}

Usage

you can use DragDropListView as GridView, just adding two attributes.

,

android:id="@+id/list_view"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:clipToPadding="false"

android:divider="@null"

android:horizontalSpacing="5dip"

android:verticalSpacing="5dip"

android:fadingEdge="none"

android:nestedScrollingEnabled="true"

android:numColumns="4"

app:fixed_type="true"/>

you must layout a ImageView for drag shadow

android:id="@+id/activity_overlay"

android:layout_width="match_parent"

android:layout_height="match_parent">

android:id="@+id/tile_drag_shadow_overlay"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:importantForAccessibility="no"

android:visibility="gone" />

final ImageView dragShadowOverlay =

(ImageView) findViewById(R.id.tile_drag_shadow_overlay);

mListView.setDragShadowOverlay(dragShadowOverlay);

and you must extend AbsTileAdapter to implement two abstract methods that are necessary.

You must implement IDragEntity interface in order to ensure that you are properly ordered.

public class SimpleTileAdapter extends AbsTileAdapter {

private TileView.OnSelectedListener mListener;

public SimpleTileAdapter(Context context, DragDropListener dragDropListener, TileView.OnSelectedListener listener) {

super(context, dragDropListener);

...

}

@Override

public View getView(int position, View convertView, ViewGroup parent) {

...

}

@Override

protected IDragEntity getDragEntity(View view) {

...

}

}

mListView.getDragDropController().addOnDragDropListener(mSimpleTileAdapter);

See examples in detail.

Changelog

1.0.0Initial release

1.1.0Added some position does not drag and drop

License

Copyright 2015 - 2016 solartisan/imilk

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值