-
Notifications
You must be signed in to change notification settings - Fork 18
CollapsibleHeader
<collapsibleHeader>
• javadoc
The CollapsibleHeader component is a view that is rendered as the title bar of a form. It collapses and hides when a designated component is scrolled down, and it expands back to its contents preferred height as the designated component is scrollled up.
-
Hide the default title using
<title hidden="true"/>
. -
Insert the following tag into the view:
<collapsibleHeader scrollableComponent="#NameOfScrollableComponent"> <!-- Insert a single child component here that will be used as the header content. --> </collapsibleHeader>
where the
scrollableComponent
attribute value is a selector supported by theComponentSelector
class for identifying the component that the collapsible header responds to. When this component is scrolled up, the header will be shown. When scrolled down, it will be hidden. -
Ensure that the view contains a component that is scrollable Y that the collapsible header can reference for its scrollable component.
- scrollableComponent
-
A selector string that identifies the scrollable component. The scrollable component is a component that the collapsible header will monitor for scrolling. When this component is scrolled up, the header will expand. When it is scrolled down, the header will disappear.
Required
- collapseMode
-
Selects between
FullCollapse
andPartialCollapse
. InFullCollapse
mode, the entire header will collapse. InPartialCollapse
mode, the body has its own header, so when the title bar is collapsed, the body’s header is still visible. - fullCollapseUIID
-
TODO
- partialCollapseUIID
-
TODO
The <collapsibleHeader>
tag expects exactly one child tag, which is used as the title bar of the header.
<?xml version="1.0"?>
<border view-controller="com.example.tweetapp.controllers.HomePageViewController"
xsi:noNamespaceSchemaLocation="HomePage.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<title hidden="true"/> (1)
<use-taglib class="com.codename1.twitterui.TagLibrary"/>
<import>
import com.example.tweetapp.providers.NewsFeedProvider;
</import>
<collapsibleHeader scrollableComponent="#tweetList"> (2)
<center><label iconUIID="TwitterIcon" fontIcon="(char)0xe902" ></label></center>
</collapsibleHeader>
<tweetListView
name="tweetList" (3)
layout-constraint="center"
provider="NewsFeedProvider.class"
/>
</border>
-
We set
<title hidden="true"/>
to hide the default title bar. -
We add
<collapsibleHeader>
which will create a custom collapsible title bar. This tag expects 1 child XML tag, which it will make the contents of the title bar. -
We add the
name
attribute to the<tweetListView>
tag so that it can be referenced from thescrollableComponent
attribute in the<collapsibleHeader>
tag. The collapsible header then listens to scroll activity on this component to know when to collapse and expand.
Here is a short video clip of the collapsible header in action.