pagingcontrol, 用于ScrollableViews的页面指示器小部件

分享于 

5分钟阅读

GitHub

  繁體 雙語
Line Page Indicator Widget for Alloy
  • 源代码名称:pagingcontrol
  • 源代码网址:http://www.github.com/manumaticx/pagingcontrol
  • pagingcontrol源代码文档
  • pagingcontrol源代码下载
  • Git URL:
    git://www.github.com/manumaticx/pagingcontrol.git
    Git Clone代码到本地:
    git clone http://www.github.com/manumaticx/pagingcontrol
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/manumaticx/pagingcontrol
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    PagingControl gittio

    ScrollableViews上的页面指示的Alloy小部件。 如果你不酷,你也可以使用这个端口为 Titanium的经典版本。

    快速启动

    安装

    通过 gittio:

    
    gittio install de.manumaticx.pagingcontrol
    
    
    
    

    用法

    下面是上gif的完整例子:

    index.xml

    <Alloy>
     <Windowclass="container"> 
     <Widgetid="paging"src="de.manumaticx.pagingcontrol"onSelect="tabHandler"/>
     <ScrollableViewid="scrollableView">
     <Viewtitle="Yellow"backgroundColor="yellow"/>
     <Viewtitle="Orange"backgroundColor="orange"/>
     <Viewtitle="Red"backgroundColor="red"/>
     <Viewtitle="Purple"backgroundColor="purple"/>
     <Viewtitle="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

    functiontabHandler(e) {
     console.log('selected tab ', e.tab);
    }$.paging.setScrollableView($.scrollableView);$.index.open();

    API

    属性
    • scrollableView - 引用 scrollableView
    • indicatorColor - 指示符的颜色
    • indicatorHeight - 显示指示器的厚度
    • tabs ( 布尔型) - 是否使用标签或者仅使用指示符
    • tabWidth - 制表符的宽度
      • 如果未传递,则使用默认tabWidth的四分之一的值。
      • 如果使用 auto,标签将适合宽度
    • dividerColor - 标签之间的分隔符颜色
    • findScrollableView - 部件是否应该找到 scrollableView
    • backgroundColor - 设置标签颜色的背景
    • bottomColor - 设置选项卡边框颜色的底部
    • font - 标签标签的字体对象
    • color - 标签的颜色
    • activeColor - 活动标签标签的颜色
    方法
    • setScrollableView( ) - 允许在创建后设置 scrollableView
    • cleanup( ) - 调用这里命令删除 EventListeners
    • refresh( ) - 将视图添加到scrollableView时调用这里方法
    事件
    • select - 让你知道标签被按下的时间

    许可证

    
    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 上面 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.