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

modal window with horizontal scroll

$
0
0

var win = Ti.UI.createWindow({ width:"100%", height:"100%", backgroundColor:"#fff"

})

var botaopop = Ti.UI.createButton({ title:"pop", width:"10%",height:"10%" })

botaopop.addEventListener("click", function(e){

        var winpop = Ti.UI.createWindow({
              width:"90%", height:"20%",
              backgroundColor:"#000",
              opacity:0.8,
               //exitOnClose: true,
               //fullscreen: false,
        });

        var buttonclose = Ti.UI.createButton({
            title:"X",
            top:0,right:0,
            color:"#ff0000",
            width:"10%",
            height:"15%",
            zIndex:104

        });

        buttonclose.addEventListener("click",function(e){
            winpop.close();
        })

        winpop.add(buttonclose);

        var viewboxgeral = Ti.UI.createView({
            layout:"horizontal",
            width:"90%", height:"90%",
        });

        //tudo faz parte da view
        for(var i = 0; i <= 8; i++){
            var view = Ti.UI.createView({
            width:200, height:200,
            backgroundColor: "#000",
            opacity:0.8,
            left:0,
            id:i,
            borderRadius:5,borderWidth:2,borderColor:'#fff'

        });

        var espaco = Ti.UI.createView({
            width:"1%",height:'auto'
        })

        var textoview = Ti.UI.createLabel({
            top:0,
            left:5,
            text:"Prêmio: " + i,
            color:"#fff",

            font: { fontSize:25}

        })

        view.addEventListener("click",function(e){
            alert("Prêmio:  " + this.id);
        })

              view.add(textoview);
              viewboxgeral.add(espaco)
              viewboxgeral.add(view);


        }
    //acaba aqui a view


        var scrollViewH = Titanium.UI.createScrollView({
            contentWidth :2000,
            contentHeight : "auto",
            width:'auto',
            top : 0,
            scrollType : 'horizontal',
            showHorizontalScrollIndicator : true,
            //showVerticalScrollIndicator:true,
            //backgroundColor:"#fff",
            zoomScale : 2,
            maxZoomScale : 30,
            minZoomScale : 1
        });

            scrollViewH.add(viewboxgeral)

            winpop.add(scrollViewH);
            winpop.open();

})

win.add(botaopop); win.open();


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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