javascript - 弹出屏幕在 Android 上不起作用,但在 iOS 上起作用

标签 javascript android appcelerator

我正在尝试创建一个包含帮助信息的弹出窗口。下面的代码在 iOS 上完美运行,但在 Android 上,标签不会显示(关闭按钮会显示)。

我希望有一个简单的解决办法;-)

提前致谢!

function helpPopup() {


var myModal = Ti.UI.createWindow({
    backgroundColor : 'transparent',
    navBarHidden:true
});



var wrapperView    = Ti.UI.createView(); // Full screen
var backgroundView = Ti.UI.createView({  // Also full screen
    backgroundColor : '#000',
    opacity         : 0.5
});
backgroundView.addEventListener('click', function () {
    myModal.close();
});
var containerView  = Ti.UI.createView({  // Set height appropriately
    height          : 300,
    backgroundColor : '#FFF'
});
var someLabel      = Ti.UI.createLabel({
    text    : 'Here is your modal',
    top     : 40
});

var contactName = Ti.UI.createLabel({
    text    :'Name',
    top     :60
});

var closeButton    = Ti.UI.createButton({
    title  : 'Close',
    bottom : 40
});
closeButton.addEventListener('click', function () {
    myModal.close();
});


containerView.add(someLabel);
containerView.add(contactName);
containerView.add(closeButton);

wrapperView.add(backgroundView);
wrapperView.add(containerView);


myModal.add(wrapperView);

myModal.open({
    animate : true
});

}

最佳答案

原来Android使用白色作为默认标签颜色....iOS使用黑色。

因此,在我更改字体颜色后,它在 Android 和 iOS 上均有效:

var someLabel = Ti.UI.createLabel({ text : '这是你的模态', 顶部:40, 颜色:'#000' });

关于javascript - 弹出屏幕在 Android 上不起作用,但在 iOS 上起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32368466/

相关文章:

android - 意外包含在 settings.gradle 文件中删除的 ':app' 行我无法同步或运行项目

android - 资源 "XX"(7f07005e) 不是 Drawable(颜色或路径): TypedValue{t=0x1/d=0x7f07005e a=-1 r=0x7f07005e}

javascript - 我无法获得 ES6 的 promise

javascript - ajax 和 php 之间的数组 json

javascript - 获取任意给定数量的包含字符串的数组的交集元素的函数

android - Android 上电子邮件中的 HTML 链接

javascript - 如何强制函数连续执行?

javascript - 阶乘函数输出不显示,不会从文本框中获取值

android - Achartengine - Android 中条形图的不同条形颜色

ios - 单击将触发 native iOS 屏幕的 webview 内的链接(使用从 webview 传递的参数)