代码之家  ›  专栏  ›  技术社区  ›  Robin Duckett

如何修复我的钛开发者应用程序标签在TableView上的呈现方式?

  •  1
  • Robin Duckett  · 技术社区  · 14 年前

    我无法按预期方式呈现以下代码:

    var img = Titanium.UI.createImageView({
      top: 0,
      left: 0,
      width: 140,
      height: 92,
      image: 'http://cdn.monmotors.com/tn_' + imgr,
      defaultImage: 'car.png'
    });
    
    post_view.add(img);
    
    var lbl = Titanium.UI.createLabel({
      text: desc,
      left: 160,
      width: 'auto',
      top: 0,
      height: 92,
      textAlign: 'left',
      color: '#ffffff',
      font: {
        fontSize: 12,
        fontWeight: 'bold'
      },
    });
    
    post_view.add(lbl);
    

    这就是它的渲染方式:

    Android Screenshot

    有人知道我怎样才能做到这一点吗?提前谢谢。

    2 回复  |  直到 14 年前
        1
  •  1
  •   Trott    14 年前

    top 以负值(如果 height 因为图像设置为92)。但是,如果图像大小不同,则可能需要适当地改变该值。

    理想情况下,设置 layout: horizontal top: 0 对你有用,但看起来 horizontal may not be supported (yet, at least) for Android in Appcelerator . 那是9个月前的消息, this link from three weeks ago says that it's now supported

        2
  •  1
  •   rivenate247    14 年前

    顶部:-70(或其他-#)应该显示出来