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]
[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]
[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]
[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]

被折叠的 条评论
为什么被折叠?



