聊天气球 - iOS - Android
Chat balloons - iOS - Android
我正在开发一个聊天风格的应用程序。我无法让气球根据文字变大变小..
有人知道我该怎么做吗?我目前的代码如下:
var scrollTxtResp = Ti.UI.createScrollView({
contentWidth: 'auto',
contentHeight: 'auto',
layout: 'vertical',
showVerticalScrollIndicator: true,
showHorizontalScrollIndicator: false,
top:0,
height: '100%',
width: '100%'
});
view.add(scrollTxtResp);
var lblTexto = Titanium.UI.createLabel({
left: 2,
width: '98%',
height: 'auto',
textAlign: Titanium.UI.TEXT_ALIGNMENT_LEFT,
text: Dec(json[pos].content),
color: clr_aux5,
font: { fontFamily: font_primaria, fontSize: 15 }
});
scrollTxtResp.add(lblTexto);
我正在使用带有 SDK 5.2.2 GA 的经典开发 (iOS / Android)
提前致谢。
看看http://developer.android.com/tools/help/draw9patch.html
9-补丁图像就是你要找的。
还有两个模块可以创建气泡视图:
- iOS: https://github.com/k0sukey/TiBubbleView
- Android: https://github.com/tdtsh/TiBubbleViewForAndroid
他们会创建一个视图,您可以使用例如标签:
var TiBubble = require('be.k0suke.tibubble');
var bubble = TiBubble.createView({
top: 0,
left: 10,
width: Ti.UI.SIZE, // just fit from contained label
height: Ti.UI.SIZE, // just fit from contained label
bubbleColor: '#dfdee5', // default: #fff
bubbleRadius: 20, // default: 20
bubbleBeak: TiBubble.BUBBLE_BEAK_LEFT // default BUBBLE_BEAK_LEFT
bubbleBeakVertical: TiBubble.BUBBLE_BEAK_UPPER // default BUBBLE_BEAK_LOWER
});
bubble.add(label);
我正在开发一个聊天风格的应用程序。我无法让气球根据文字变大变小..
有人知道我该怎么做吗?我目前的代码如下:
var scrollTxtResp = Ti.UI.createScrollView({
contentWidth: 'auto',
contentHeight: 'auto',
layout: 'vertical',
showVerticalScrollIndicator: true,
showHorizontalScrollIndicator: false,
top:0,
height: '100%',
width: '100%'
});
view.add(scrollTxtResp);
var lblTexto = Titanium.UI.createLabel({
left: 2,
width: '98%',
height: 'auto',
textAlign: Titanium.UI.TEXT_ALIGNMENT_LEFT,
text: Dec(json[pos].content),
color: clr_aux5,
font: { fontFamily: font_primaria, fontSize: 15 }
});
scrollTxtResp.add(lblTexto);
我正在使用带有 SDK 5.2.2 GA 的经典开发 (iOS / Android)
提前致谢。
看看http://developer.android.com/tools/help/draw9patch.html
9-补丁图像就是你要找的。
还有两个模块可以创建气泡视图:
- iOS: https://github.com/k0sukey/TiBubbleView
- Android: https://github.com/tdtsh/TiBubbleViewForAndroid
他们会创建一个视图,您可以使用例如标签:
var TiBubble = require('be.k0suke.tibubble');
var bubble = TiBubble.createView({
top: 0,
left: 10,
width: Ti.UI.SIZE, // just fit from contained label
height: Ti.UI.SIZE, // just fit from contained label
bubbleColor: '#dfdee5', // default: #fff
bubbleRadius: 20, // default: 20
bubbleBeak: TiBubble.BUBBLE_BEAK_LEFT // default BUBBLE_BEAK_LEFT
bubbleBeakVertical: TiBubble.BUBBLE_BEAK_UPPER // default BUBBLE_BEAK_LOWER
});
bubble.add(label);