【问题标题】:Titanium appcelerator animate view blinksTitanium appcelerator 动画视图闪烁
【发布时间】:2016-10-23 09:39:33
【问题描述】:

我想在点击相应按钮时为视图设置动画,不幸的是当从上到下的动画闪烁时:

/*
* ANIMATE FROM BOTTOM TO TOP
*/
function showModal(item){
    var bottom_to_top = Ti.UI.createAnimation({
        top : '0%',
        duration : 500
    });
    $[item].animate(bottom_to_top)
}

/*
* ANIMATE FROM TOP TO BOTTOM
*/
function hideModal(item){
    var top_to_bottom = Ti.UI.createAnimation({
        top : '100%',
        duration : 500
    });
    $[item].animate(top_to_bottom)
}

///// HERE I SHOW HIDE MY VIEW
function button_show(){
    showModal($.myView);
}
function button_hide(){
    hideModal($.myView);
}

第一个问题,如果我指定“100%”隐藏视图,当我尝试显示时它不会出现,只有值 99 及以下有效。 第二个问题,隐藏视图时动画闪烁。

有人能告诉我应该怎么做吗?谢谢。

【问题讨论】:

    标签: titanium appcelerator appcelerator-titanium titanium-alloy


    【解决方案1】:

    尽量避免百分比边距。此外,使用原生技术来显示模态窗口,例如

    var window = Ti.UI.createWindow({
        title: "My Modal Window",
        backgroundColor: "white"
    });
    
    var nav = Ti.UI.iOS.createNavigationWindow({
        window: window
    });
    
    nav.open({
        modal: true
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-09
      相关资源
      最近更新 更多