2017-04-01 87 views
0

這裏是我的代碼分割成合金/ JS /造型 不管我在哪裏放置borderRadius/borderWidth性能卻忽視了它鈦Appcelerator的圓角?

合金:

<Label id="image_label"></Label> 

JS:

function setAnnotation(location) { 

    var annotation = map.createAnnotation({ 
    title: location.title, 
    subtitle: location.latitude + ', ' + location.longitude, 
    latitude: location.latitude, 
    longitude: location.longitude, 
    image: $.image_label.toImage(), 
    borderRadius:22, //DOESNT WORK 
    borderWidth: 6, //DOESNT WORK 

    }); 

$.map.setAnnotations([annotation]); 
} 

風格:

//LABEL ANNOTATION 
"#image_label": { 
color : 'black', 
font : {fontSize:'15dp',font:"monospace",fontWeight:"bold"}, 
height : '30dp', 
width : '30dp', 
borderRadius:999, //DOESNT WORK 
borderWidth: 99, //DOESNT WORK 
backgroundImage:'https://pbs.twimg.com/profile_images/604644048/sign051.gif' 

}

回答

2

最好的辦法是創建一個視圖和一個標籤和borderRadius /邊框寬度/和backgroundImage添加到視圖,然後在最後asssign的view.toImage()的註釋。請記住,註釋本身不具有borderRadius/BorderWidth屬性(http://docs.appcelerator.com/platform/latest/#!/api/Modules.Map.Annotation

var view = Ti.UI.createView({ 
    width:30, 
    height:30, 
    borderRadius:15, 
    borderWidth: 3, 
    backgroundImage:'https://pbs.twimg.com/profile_images/604644048/sign051.gif' 
}); 
var lbl = Ti.UI.createLabel({ 
    text:"2" 
}); 
view.add(lbl); 

mapView.addAnnotation(
    maps.createAnnotation({ 
     latitude: 37.368122, 
     longitude: -121.913653, 
     title: "company", 
     image: view.toImage() 
    }) 
) 

你也可以將它放入一個小部件的視圖,並填寫文本/圖片與參數使用電源並保持代碼免費的視圖代碼。

+0

我從你明白的是我應該使用,而不是標籤元素查看, 它仍然does not工作IM仍然讓周圍的圓形圖像方白 http://i.imgur.com/nEYNsl4.png –

+0

HTTPS:/ /ibb.co/gn53tv對我來說工作得很好。我已經用該代碼更新了示例 – miga