ExpandablePanel空间查看大图特效

本文介绍了一个Android库ExpandablePanel,它提供了一种通过滑动来展开顶部或底部视图的逻辑。该库支持自定义属性,可以设置不同的视图作为可展开的,并且适用于包含多个视图的布局。它还提供了开始展开时的反弹动画、自动展开和收缩速度等特性。使用方法包括在XML布局中添加ExpandablePanelView,设置两个子视图,并为需要交互的视图分配ID。
摘要由CSDN通过智能技术生成

Expandable Panel Android Library

Demo Screenshot 1Demo Screenshot 2Demo Screenshot 3Demo Screenshot 4

Check ExpandablePanel Demo application on GooglePlay:
Get it on Google Play

Details

This Android library implements the expand by sliding logic for a top or a bottom view in a two children view composition. That's the default behaviour, but it allows you to set a different View as the expandable one, making this component support multiple views inside it. It supports Android SDK 2.1 (Eclair) as minimum.

ExpandablePanel library brings a custom view class called ExpandablePanelView to the final user. It implements the needed logic for integrating the expandable logic into your own Android application.

Custom Attributes

ExpandablePanel lib allows you to customize the following properties. Feel free to combine them to create cool user interfaces:

  • expandablepanel:completionPercent: % of the parent's height where you want the autocomplete animation to begin working.
  • expandablepanel:completeExpandAnimationSpeed: Speed for the autocomplete animation.
  • expandablepanel:completeShrinkAnimationSpeed: Speed for the autoshrink animation.
  • expandablepanel:beginExpanded: Use it if you need the topView to begin expanded. If that's your case, the view will play a bounce animation at start to inform the user about the hidden bottom view.
  • expandablepanel:bounceCount: Use it to set the number of times topView is going to play bounce animation when it begins expanded.
  • expandablepanel:invertBehavior: Use it to invert the panel's behaviour and make bottomView become the expandable one. You can combine it with any other custom attributes. Bounce animation will get inverted too when using this attr.
  • expandablepanel:animableViewId: Use it to assign an animable view using the view identifier if your ExpandablePanelView contains more than 2 child. This attribute is not mandatory, if you don't use it, first or second child (based on the expandablepanel:invertBehavior attribute) is going to be used as the animable view.
  • expandablepanel:autoAnimateOnClick: Use this one to enable automatic expanding or shrinking when user clicks on animable view.

Usage

In order to make it work, you will need to use ExpandablePanelView class into your Android XML Layout.

  • 1. Add ExpandablePanelView to the layout.
  • 2. Add two children views to the ExpandablePanelView XML element.
  • 3. ExpandablePanelView extends RelativeLayout, so you will need to give an android id to the top view and setup the android:below attribute in the bottom one.
  • 4. Set the xmlns:draggable_view="http://schemas.android.com/apk/res-auto" if you are going to use any of the cusom attributes.

Use ExpandableListener if you want your class to be able to get expandable callbacks. Following methods are offered to the user:

  • onExpandingStarted: Dispatched when the user starts expanding the view.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值