Search code examples
titaniumtitanium-mobiletitanium-modulestitanium-alloy

Options Dialog Button UI change Titanium Appcelerator


am using 3.1.3.GA SDK, Alloys and 4.2 Android Emulator and am using option dialog to show my options to the users and I need to change its selector button from this type to as our design/theme. How to achieve it.


Solution

  • You have to create it by your own, a first look it would be a Window with 0.7 opacity, a view that contains the the black and two white views (preferably horizontal ) each of them contains a label and another view or button for your custom confirmation, you can also use border width and border color for the light gray details. i have created something similar: http://postimg.org/image/6ygh7wi6p/

    Here is the code:

                var mainWindow = Titanium.UI.createWindow({
                  modal: true,
                  navBarHidden : true,
                  backgroundImage:"/global/bg-opacity.png_preview_70x50.png"
                });
    
    
                var alertView = Ti.UI.createView({
                    width: 300,
                    height: 500,
                    borderColor : Alloy.CFG.colors.SILVER,
                    borderWidth : 1,
                    backgroundColor:"black",
                });
    
                var titleLabel = Ti.UI.createLabel({
                    top: 10,
                    height : 40,
                    left:10,
                    color : "white",
                    font : Alloy.CFG.fonts.DEFAULT_22_BOLD,
                    text: "BACK-UP CARE MOBILE"
                });
    
                var testWrapper = Ti.UI.createScrollView({
                    top:55,
                    widht:Ti.UI.FILL,
                    height:385,
                    borderColor : "#181818",
                    borderWidth : 1
                });
    
                alertView.add(testWrapper);
    
                var textLabel = Ti.UI.createLabel({
                    top : 10,
                    bottom: 10,
                    left : 20,
                    right : 20,
                    textAlign: "left",
                    height : Ti.UI.SIZE,
                    font : Alloy.CFG.fonts.DEFAULT_17,
                    color : "white",
                    text : App.localize("FIRST_RUN_MESSAGE")
                });
    
                testWrapper.add(textLabel);
    
                var buttonsWrapper = Ti.UI.createView({
                    top:440,
                    height:60,
                    widht:Ti.UI.FILL,
                    backgroundColor:"#848684"
                });
    
                alertView.add(buttonsWrapper);
    
                var continueBtn = Ti.UI.createButton({
                    title: 'Continue',
                    top: 5,
                    width: 140,
                    height: 50,
                    left:155
                });
    
                buttonsWrapper.add(continueBtn);
    
                var createProfileBtn = Ti.UI.createButton({
                    title: 'Create Profile',
                    top: 5,
                    width: 140,
                    height: 50,
                    left:5
                });
    
                buttonsWrapper.add(createProfileBtn);
    
                mainWindow.addEventListener("android:back", function(){
    
                });
    

    Hope it helps.