-
Notifications
You must be signed in to change notification settings - Fork 31
Hidden view
The swipeable hidden view implementation provides a lot of functionality without limiting the developer to something specific. It enables you to create a view which can be swiped to a side and uncover a view behind it. This sounds really unspectacular but it's fundamental for further implementations e.g. for the Quick action implementation. The Showcase app is demonstrating a custom implementation and use of this API.
Here's an example how a layout definition looks like. If you want to put complex content into the view you have to use a layout because a single child view is supported only. Furthermore the SwipeableHiddenView can't have paddings. The layout parameters of the child (and hidden view) will be ignored, they will always fill the parent, anything else would lead to ugly results.
<de.viktorreiser.widget.SwipeableHiddenView
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Main content of the swipeable view" />
</de.viktorreiser.widget.SwipeableHiddenView>
You'll need to create a custom setup for the hidden view and set it on the view. This is described in Swipeable (list) view (setHiddenViewSetup
). The custom setup class extends HiddenViewSetup and implements the necessary method which returns the hidden view. So the setup class is managing the communication with the hidden view.
Again, the Showcase app demonstrates how to implement such a setup. To be more specific: SwipeableListDetachedActivity.