Android UI ListView的滑动删除效果之SwipeListView

SwipeListView是对ListView的扩展,实现滑动显示删除等操作按钮。

[url=https://github.com/47deg/android-swipelistview]https://github.com/47deg/android-swipelistview[/url]

[color=red]***依赖于NineOldAndroids [url=https://github.com/JakeWharton/NineOldAndroids]https://github.com/JakeWharton/NineOldAndroids[/url][/color]

[b]在layout的布局文件中使用SwipeListView:[/b]
<com.fortysevendeg.swipelistview.SwipeListView
xmlns:swipe="http://schemas.android.com/apk/res-auto"
android:id="@+id/example_lv_list"
android:listSelector="#00000000"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
swipe:swipeFrontView="@+id/front"
swipe:swipeBackView="@+id/back"
swipe:swipeActionLeft="[reveal | dismiss]"
swipe:swipeActionRight="[reveal | dismiss]"
swipe:swipeMode="[none | both | right | left]"
swipe:swipeCloseAllItemsWhenMoveList="[true | false]"
swipe:swipeOpenOnLongPress="[true | false]"
swipe:swipeAnimationTime="[miliseconds]"
swipe:swipeOffsetLeft="[dimension]"
swipe:swipeOffsetRight="[dimension]"
/>

[list]
[*]swipeFrontView - Required - front view id.
[*]swipeBackView - Required - back view id.
[*]swipeActionLeft - Optional - left swipe action Default: 'reveal'
[*]swipeActionRight - Optional - right swipe action Default: 'reveal'
[*]swipeMode - Gestures to enable or 'none'. Default: 'both'
[*]swipeCloseAllItemsWhenMoveList - Close revealed items on list motion. Default: 'true'
[*]swipeOpenOnLongPress - Reveal on long press Default: 'true'
[*]swipeAnimationTime - item drop animation time. Default: android configuration
[*]swipeOffsetLeft - left offset
[*]swipeOffsetRight - right offset
[/list]

[b]swipeFrontView和swipeBackView必须和list_item.xml中设置的布局ID相同。[/b]

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="60dp"
tools:context=".MainActivity" >

<LinearLayout
android:id="@+id/back"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffcccccc"
android:gravity="center|right" >
<Button
android:id="@+id/remove"
style="@style/button_text"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/red_button"
android:text="Delete" >
</Button>
</LinearLayout>

<LinearLayout
android:id="@+id/front"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffffff" >
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textSize="25sp"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLarge" >
</TextView>
</LinearLayout>

</FrameLayout>


[b]效果图:[/b]
[img]http://dl2.iteye.com/upload/attachment/0093/2848/92efc3aa-5321-380b-a13a-e344d96bf09c.png[/img]

[b]对比微信5的订阅号页面:[/b]
[img]http://dl2.iteye.com/upload/attachment/0093/2850/7c8c12d9-364c-372d-acc7-7bb063f0d7e1.png[/img]
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值