Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

custom page control

$
0
0

hi , i need a guidence from you guys, actually i need a custom page control for android. for that i wrote a code like this.but the data will come dynamically

//********scrollview for android **********/// 
var pagingmain = Ti.UI.createView({
                height:45,
                width: Ti.UI.FILL,
                left:'0',
                bottom:0,
                shadowColor:'#aaa',
                shadowOffset:{x:5, y:5},
                shadowRadius: 3,
                backgroundColor:'#78C573'
            });
var paging = Ti.UI.createView({
                height:30,
                width: Ti.UI.SIZE,
                left:'45%',
                bottom:0,
 
            });
 
            var pageLength = $.scrollableView.views.length; //get the number of views
            var page = [];
 
 
                var pagingDot = Ti.UI.createView({
                    backgroundColor: '#000',
                    borderRadius: '50',
                    height: 20,
                    width: 15,
                    bottom: 10,
                    left: 20 ,
 
                });
 
                page.push(pagingDot);
                paging.add(pagingDot);
                pagingmain.add(paging);
                $.scrollableView.add(pagingmain);
 
 
            page[$.scrollableView.getCurrentPage()].setBackgroundColor("#ddd"); //set the initial colour
 
            // I Attach the scroll event to scrollableView, so we know when to update things
            $.scrollableView.addEventListener("scrollend", function (e) {
                if (e.currentPage || e.currentPage == 0) {
 
                    // Go through each and reset it's color
                    for (var c = 0; c < pageLength; c++) {
                        page[c].setBackgroundColor("#000");
                    }
                    // Bump the Color of the new current page
                    page[e.currentPage].setBackgroundColor("#ddd");
 
                }
                }); 
        //********scrollview for android **********///

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>