Android上ListView自定义模板中的Appcelerator钛缺陷

Android上ListView自定义模板中的Appcelerator钛缺陷,android,ios,iphone,appcelerator,appcelerator-titanium,Android,Ios,Iphone,Appcelerator,Appcelerator Titanium,我最近将我的appcelerator项目从5.5.1 Tianium SDK升级到了6.1.0 Android上列表视图的自定义模板在6.1.1中的行为与在5.5.1和我使用过的所有Tianium之前版本中的行为不同。问题在于将水平布局视图嵌套在垂直布局视图中 在这个bug示例中,列表视图以英语显示水果的名称,然后水平显示法语、德语和西班牙语的翻译,但在英语名称下面 从所附图片中可以看出,iPhone版本显示正确,但Android版本缺少翻译。钛合金5.5.1及更早版本在两个平台上均正确显示 在

我最近将我的appcelerator项目从5.5.1 Tianium SDK升级到了6.1.0

Android上列表视图的自定义模板在6.1.1中的行为与在5.5.1和我使用过的所有Tianium之前版本中的行为不同。问题在于将水平布局视图嵌套在垂直布局视图中

在这个bug示例中,列表视图以英语显示水果的名称,然后水平显示法语、德语和西班牙语的翻译,但在英语名称下面

从所附图片中可以看出,iPhone版本显示正确,但Android版本缺少翻译。钛合金5.5.1及更早版本在两个平台上均正确显示

在自定义模板中,我使用了背景色,以便于查看每个视图和标签的显示位置

有人知道为什么安卓版本缺少字幕吗?这是钛虫还是我做错了什么

以下是正确显示的iPhone图像:

这是缺少字幕的Android图像

下面是复制Android bug所需的所有代码。确保您使用的是Tianium 6.1.0 SDK

var win = Ti.UI.createWindow({backgroundColor: 'white'});

// Create a custom template that displays the English title, then three
// subtitles for French, German & Spanish laid out horizontally below the
// English title
var myTemplate = {
    properties: {
        height: Ti.UI.SIZE,
        width: Ti.UI.FILL
    },
    childTemplates: [
        {
            type: 'Ti.UI.View',
            properties: {
                backgroundColor: '#fcf',
                height: Ti.UI.SIZE,
                layout: 'vertical',
                left: 15,
                right: 15,
                width: Ti.UI.FILL
            },
            childTemplates: [
                {                            // English 
                    type: 'Ti.UI.Label',     // Use a label for the text 
                    bindId: 'english',       // Maps to the english property of the item data
                    properties: {            // Sets the label properties
                        color: 'black',
                        font: { fontFamily:'Arial', fontSize: '20dp', fontWeight:'bold' },
                        left: 0
                    }
                },
                {                               // Container for language subtitles
                    type: 'Ti.UI.View',
                    properties: {
                        backgroundColor: '#ffc',
                        height: Ti.UI.SIZE,
                        layout: 'horizontal',   // subtitles should be laid out horiznontally
                    },
                    childTemplates: [
                        {                            // French 
                            type: 'Ti.UI.Label',     // Use a label for the text 
                            bindId: 'french',        // Maps to the french property of the item data
                            properties: {            // Sets the label properties
                                backgroundColor: 'gray',
                                color: 'white',
                                font: { fontFamily:'Arial', fontSize: '14dp' },
                                right: 10
                            }
                        },
                        {                            // German 
                            type: 'Ti.UI.Label',     // Use a label for the text 
                            bindId: 'german',        // Maps to the german property of the item data
                            properties: {            // Sets the label properties
                                backgroundColor: 'red',
                                color: 'white',
                                font: { fontFamily:'Arial', fontSize: '14dp' },
                                right: 10
                            }
                        },
                        {                            // Spanish 
                            type: 'Ti.UI.Label',     // Use a label for the text 
                            bindId: 'spanish',       // Maps to the spanish property of the item data
                            properties: {            // Sets the label properties
                                backgroundColor: 'blue',
                                color: 'white',
                                font: { fontFamily:'Arial', fontSize: '14dp' },
                                right: 10
                            }
                        }
                    ]
                }
            ]
        }
    ]
};

// Create the list view
var listView = Ti.UI.createListView({
    templates: { 'template': myTemplate },
    defaultItemTemplate: 'template',
    top: Ti.Platform.osname === 'iphone' ? 20 : 0   // Allow for iOS status bar
});

// Create the list data set
var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits'});
var fruitDataSet = [
    { english: {text: 'Apple'}, french: {text: 'Pomme', visible: true}, german: {text: 'Apfel'}, spanish: {text: 'Manzana'}},
    { english: {text: 'Banana'}, french: {text: 'Banane'}, german: {text: 'Banane'}, spanish: {text: 'Plátano'}}
];
fruitSection.setItems(fruitDataSet);

// Add the data set to the list view
var sections = [fruitSection];
listView.setSections(sections);

// Add the list view to the main window and open it
win.add(listView);
win.open();

Appcelerator已在Tianium SDK 6.1.1.V2017061513917中修复了此问题

尝试在listView.setSections(sections)之后设置FrootSection.setItems(FrootDataSet)。