テーブルローに日の名前のラベルを付けたいです。これは、ラベルの実際の幅がわからないことを意味し、そのlabel.toImage()。widthは、レイアウト後のイベントの後でも実際のサイズを返しません。また、スクロールビューをランダムなテキスト(場合によっては非常に大きい)で水平方向に配置したいと思います。私が持っているものは:
var storehoursscrollingmessagestyle = {
left:"10dp",
font:{fontSize:'18dp',fontWeight:"bold"}
};
var storehoursscrollviewstyle = {
contentWidth: 'auto',
contentHeight: 'auto',
height: '70dp',
width:Ti.UI.FILL,
scrollType: 'horizontal'
};
var storehoursrowstylegray={
classNane:"storeoptions",
selectedBackgroundColor:"#E8E8E8",
backgroundColor:"#E8E8E8",
height:"70dp"};
var storehoursrowlabelstyle={
left:"10dp",
height:"70dp",
font:{fontSize:'18dp',fontWeight:"bold"},
color:"Black"
};
var storehoursviewrowstyle ={
width:'200dp',
height:'70dp',
layout:'horizontal'
};
var storehoursbuttontitleview = Titanium.UI.createLabel(storehoursrowlabelstyle);
storehoursbuttontitleview.text = dayMappings[today] + " " + openTimeFormatted + " - " + closeTimeFormatted;
storehoursbuttonview.add(storehoursbuttontitleview);
var view = Ti.UI.createView(storehoursviewrowstyle);
var scrollview = Ti.UI.createScrollView(storehoursscrollviewstyle);
scrollview.add(storehoursscrollingmessagetitleview);
view.add(storehoursbuttontitleview);
var subviewviewforscrollview = Ti.UI.createView(storehoursviewrowstyle);
subviewviewforscrollview.add(scrollview);
view.add(subviewviewforscrollview);
storehoursbuttonview.add(view);
幅を「30%」に設定すると、storehoursscrollviewstyleに水平レイアウトが表示されますが、100%に設定すると、スクロールビューが消えます。
したがって、私の質問は、サイズを知らずに、また相互にハードコードされた幅の値を設定せずに、テーブル行内にラベルとスクロールビューを配置する方法です。