Alloy Widget for a page indication on ScrollableViews. If you're not cool, you also can use this Port for Titanium Classic.
Via gittio:
gittio install de.manumaticx.pagingcontrol
Here's the complete example from the above gif:
index.xml
<Alloy>
<Window class="container" >
<Widget id="paging" src="de.manumaticx.pagingcontrol" onSelect="tabHandler" />
<ScrollableView id="scrollableView">
<View title="Yellow" backgroundColor="yellow" />
<View title="Orange" backgroundColor="orange" />
<View title="Red" backgroundColor="red" />
<View title="Purple" backgroundColor="purple" />
<View title="Blue" backgroundColor="blue" />
</ScrollableView>
</Window>
</Alloy>
index.tss
".container" : {
backgroundColor: "#fff",
layout: "vertical"
},
"#paging" : {
top: 0,
indicatorColor: "#09c",
tabs: true,
backgroundColor : "#cacaca",
font : {
fontSize : 20,
fontWeight : 'bold'
}
}
index.js
function tabHandler(e) {
console.log('selected tab ', e.tab);
}
$.paging.setScrollableView($.scrollableView);
$.index.open();
scrollableView
- reference the scrollableViewindicatorColor
- Color of the indicatorindicatorHeight
- Thickness the indicatortabs
(Boolean) - wether to use tabs or only the indicatortabWidth
- width of a tab- if not passed, a default tabWidth of a quarter of the total with is used
- if
auto
is used, tabs will fit the width
dividerColor
- Color of the divider between the tabsfindScrollableView
- whether should widget is find scrollableViewbackgroundColor
- sets the tab's background colorbottomColor
- sets the tab's bottom border colorfont
- font object for tab labelscolor
- color for the labelsactiveColor
- color for the active tab label
setScrollableView( )
- lets you set the scrollableView after creationcleanup( )
- call this to remove EventListenersrefresh( )
- call this when views were added (or removed) to scrollableView
select
- lets you know when a tab was pressed and which one was
The MIT License (MIT)
Copyright (c) 2014 - 2016 Manuel Lehner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.