Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mobile 钛Appcelerator移动链接滚动视图保持顶部标签的位置,无延迟_Mobile_Scroll_Titanium_Scrollview_Appcelerator - Fatal编程技术网

Mobile 钛Appcelerator移动链接滚动视图保持顶部标签的位置,无延迟

Mobile 钛Appcelerator移动链接滚动视图保持顶部标签的位置,无延迟,mobile,scroll,titanium,scrollview,appcelerator,Mobile,Scroll,Titanium,Scrollview,Appcelerator,我创建了两个链接的滚动视图。。 我希望“timelineView”在垂直滚动时保持在顶部,但它是滞后的,因为每次滚动事件触发时我都会设置顶部。。 有人能帮我把事情弄顺利吗 注意:这是有效的,它只是滞后的。 注2:水平滚动时,timelineView水平滚动,与滚动视图“这是x行”标签相同 亲切问候, 德克(荷兰) Titanium.UI.setBackgroundColor('#000'); // //创建基本UI选项卡和根窗口 // var win=tianium.UI.createWindo

我创建了两个链接的滚动视图。。 我希望“timelineView”在垂直滚动时保持在顶部,但它是滞后的,因为每次滚动事件触发时我都会设置顶部。。 有人能帮我把事情弄顺利吗

注意:这是有效的,它只是滞后的。

注2:水平滚动时,timelineView水平滚动,与滚动视图“这是x行”标签相同

亲切问候,

德克(荷兰)

Titanium.UI.setBackgroundColor('#000');
//
//创建基本UI选项卡和根窗口
//
var win=tianium.UI.createWindow({
标题:'我的幻想时间表',
背景颜色:“#666”,
url:“/main_windows/scrollview.js”,
纳瓦尔:是的,
宽度:320,
排名:0
});
var startHeight=35;
var currentY=启动灯;
var areaLabelHeight=20;
var timelineWidth=1000;
var timelineHeight=100;
var保证金=5;
var currentArea=0;
var view=Ti.UI.createScrollView({
宽度:win.width,
contentWidth:win.width,
身高:赢,身高,
左:0,,
排名:0,
zIndex:7
});
var scrollView=Ti.UI.createScrollView({
宽度:win.width,
contentWidth:timelineWidth,
zIndex:10,
排名:0
});
var scrollView2=Ti.UI.createScrollView({
宽度:win.width,
身高:赢,身高,
contentWidth:timelineWidth,
zIndex:5,
排名:0,
背景颜色:“#f00”
});
var timelineView=Ti.UI.createView({
宽度:时间线宽度,
身高:20,
左:0,,
排名:0,
zIndex:30
});
var timeline=Ti.UI.createLabel({
文本:“时间线”,
宽度:时间线宽度,
身高:20,
排名:0,
左:0,,
textAlign:'左',
颜色:“#fff”,
背景颜色:“#000”,
字体:{fontSize:10,fontWeight:'bold',zIndex:31,textAlign:'left'},
zIndex:31
});
timelineView.add(时间线);
对于(i=0;i=0){
Ti.API.info(“背景点:“+bgPoint.x+”,“+bgPoint.y”)
timelineView.setTop(bgPoint.y);
}
}
捕捉(错误){
Ti.API.error(错误);
}
});
win.open();

您好,我也面临类似的问题,并要求您在中提供一些指导。您是否解决了此问题?很抱歉,回复太晚,但没有。很遗憾,我还没有解决。没问题。。感谢您的回复:)
Titanium.UI.setBackgroundColor('#000');

//
// create base UI tab and root window
//
var win = Titanium.UI.createWindow({  
    title:'My fancy Schedule',
    backgroundColor: '#666',
    url: '/main_windows/scrollview.js',
    navBarHidden: true,
    width: 320,
    top: 0
});

var startHeight = 35;
var currentY = startHeight;
var areaLabelHeight = 20;
var timelineWidth = 1000;
var timelineHeight = 100;
var margin = 5;
var currentArea = 0;

var view = Ti.UI.createScrollView({
    width: win.width,
    contentWidth: win.width,
    height: win.height,
    left: 0,
    top: 0,
    zIndex: 7
});

var scrollView = Ti.UI.createScrollView({
    width: win.width, 
    contentWidth: timelineWidth,
    zIndex: 10,
    top: 0
});

var scrollView2 = Ti.UI.createScrollView({
    width: win.width, 
    height: win.height,
    contentWidth: timelineWidth,
    zIndex: 5,
    top: 0,
    backgroundColor: '#f00'
});

var timelineView = Ti.UI.createView({
    width: timelineWidth, 
    height: 20,
    left: 0,
    top: 0,
    zIndex: 30
});

var timeline = Ti.UI.createLabel({
    text: 'Timeline',
    width: timelineWidth, 
    height: 20,
    top: 0,
    left: 0,
    textAlign: 'left',
    color: '#fff',
    backgroundColor: '#000',
    font: {fontSize:10, fontWeight:'bold', zIndex: 31, textAlign: 'left'},
    zIndex: 31
});

timelineView.add(timeline);

for(i=0; i<10;i++) {
    currentArea = i+1;

    view.add(Ti.UI.createLabel({
        text: 'Area ' + currentArea.toString(),
        width: '100%', 
        height: areaLabelHeight,
        textAlign: 'left',
        zIndex: 20,
        top: currentY,
        left: 5,
        color: '#fff'
    }));

    currentY = currentY + areaLabelHeight + margin;

    scrollView.add(Ti.UI.createLabel({
        text: 'This is line ' + currentArea.toString(),
        width: timelineWidth, 
        height: timelineHeight,
        top: currentY,
        textAlign: 'left',
        backgroundColor: '#ccc'
    }));

    currentY = currentY + timelineHeight + margin;
}

view.setContentHeight(currentY);
scrollView.setHeight(currentY);
scrollView.add(timelineView);

view.add(scrollView);
win.add(view);


view.addEventListener('scroll', function(e){
    try{
        var bgPoint = view.convertPointToView(e, view);

        if(bgPoint.x == 0 && bgPoint.y > 0) {
            Ti.API.info("Background Point: " + bgPoint.x + "," + bgPoint.y)
            timelineView.setTop(bgPoint.y);
        }
    }
    catch(err) {
        Ti.API.error(err);
    }
});

win.open();