“选项”对话框按钮 UI 更改钛合金应用器



正在使用 3.1.3.GA SDK,合金和4.2 Android模拟器,并且正在使用选项对话框向用户显示我的选项,我需要将其选择器按钮从此类型更改为我们的设计/主题。如何实现它。

您必须自己创建它,乍一看它将是一个不透明度为 0.7 的窗口,一个包含黑视图和两个白色视图(最好是水平视图)的视图,每个视图都包含一个标签和另一个视图或按钮用于您的自定义确认,您还可以使用边框宽度和边框颜色作为浅灰色细节。 我创建了类似的东西:http://postimg.org/image/6ygh7wi6p/

这是代码:

            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(){
            });

希望对您有所帮助。

function createAlert(_args) {
//283x170
var alert = Ti.UI.createView({
    width:283,
    height:170,
    visible:false,
    backgroundImage:'/images/alert.png'
});
var label = Ti.UI.createLabel({
    text:'This is a custom alert box.nnAre you sure that you really want to do that?',
    width:263,
    height:100,
    top:10,
    textAlign:'center',
    color:'#fff',
    font:{
        fontWeight:'bold',
        fontSize:16
    }
});
alert.add(label);
var cancel = Ti.UI.createButton({
    width:127,
    height:42,
    bottom:10,
    left:10,
    title:'Wait a tick ...',
    backgroundImage:'/images/cancel.png'
});
cancel.addEventListener('click', function(e) {
    alert.hide();
});
alert.add(cancel);
var ok = Ti.UI.createButton({
    width:127,
    height:42,
    bottom:10,
    right:10,
    title:'Lets do it!',
    backgroundImage:'/images/ok.png'
});
ok.addEventListener('click', function(e) {
    alert.hide();
});
alert.add(ok);
return alert;

}

最新更新