Titanium “选项”对话框按钮UI更改钛Appcelerator
我使用3.1.3.GA SDK、Alloyments和4.2 Android Emulator,并使用option dialog向用户显示我的选项,我需要将其选择器按钮从type更改为作为我们的设计/主题。如何实现它。您必须自己创建它,第一次看它将是一个不透明度为0.7的窗口,一个包含黑色和两个白色视图(最好是水平)的视图,每个视图都包含一个标签和另一个视图或按钮,供您自定义确认,还可以对浅灰色细节使用边框宽度和边框颜色。我创造了类似的东西: 代码如下:Titanium “选项”对话框按钮UI更改钛Appcelerator,titanium,titanium-mobile,titanium-modules,titanium-alloy,Titanium,Titanium Mobile,Titanium Modules,Titanium Alloy,我使用3.1.3.GA SDK、Alloyments和4.2 Android Emulator,并使用option dialog向用户显示我的选项,我需要将其选择器按钮从type更改为作为我们的设计/主题。如何实现它。您必须自己创建它,第一次看它将是一个不透明度为0.7的窗口,一个包含黑色和两个白色视图(最好是水平)的视图,每个视图都包含一个标签和另一个视图或按钮,供您自定义确认,还可以对浅灰色细节使用边框宽度和边框颜色。我创造了类似的东西: 代码如下: var mai
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.\n\nAre 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;
}谢谢你,梅伊托。打开一个模态窗口并放置东西也是一个好的简单的想法,但是可以通过Tianium的默认设置来实现吗?我们可以编辑OptionDialog的主题来放置一个复选框,而不是我们想要的单选按钮和颜色方案吗。还是一个坏主意?。。我是appcel社区的新手。我认为使用他们自己的工具可能会减少错误,因此mayito.Hello@Guts从UI角度来看,AlertDialog无法修改,因为它们是来自每个平台的“本机”警报对话框(Ti.UI.pikers也会发生这种情况)您只能添加或更改文档中描述的属性:您可以添加按钮,但不能更改UI,希望此链接有帮助。谢谢。我理解,但在原生安卓系统中,我们可以更改诸如光晕光、光晕暗等主题。。有没有可能用钛来改变它。如果我们使用Halo light,Android将在不使用无线电波盒的情况下发出警报。我问过了,好的。我知道了如何在线程中更改主题,我只需要三个选项,这是静态的,所以我可以使用选项对话框本身,对于进一步的大型对话框,我可以肯定地接受你的想法。谢谢你,梅约。