1
我正在爲使用flash builder 4.6的android構建應用程序。我試圖顯示unicode字符,因爲在這個xml中「http://www.bbc.co.uk/hindi/index.xml」Flex Mobile 4.6 Unicode Android
字符在flash builder提供的模擬器上運行時正確顯示,但安裝時android會顯示方框[] [] [] [] [] [] [] [] []。我怎樣才能解決這個問題,使字體嵌入正確?
我測試的android版本是2.3.5。我的代碼below`
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
creationComplete="newCreationComplete(event)" fontSize="11" fontWeight="bold"
xmlns:s="library://ns.adobe.com/flex/spark" title="News">
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
.messageStyle{
height:20;
fontSize:11;
fontWeight:normal;
}
</fx:Style>
<fx:Script>
<![CDATA[
import com.adobe.serialization.json.JSON;
import mx.collections.ArrayCollection;
import mx.core.FlexGlobals;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import spark.events.IndexChangeEvent;
[Bindable] private var newsCollection:Array;
protected function httpServiceNews_resultHandler(event:ResultEvent):void
{
if(!newsCollection)
newsCollection = new Array();
var atom:Namespace = new Namespace("http://www.w3.org/2005/Atom");
var media:Namespace = new Namespace("http://search.yahoo.com/mrss/");
var entryList:XMLList = (event.result as XML)..atom::entry;
for each(var xml:XML in entryList){
var object:Object = new Object();
object.imageUrl = xml.atom::link..media::thumbnail.(@width == "106")[email protected];
object.summary = xml.atom::summary;
object.title = xml.atom::title;
newsCollection.push(object);
}
}
protected function httpServiceNews_faultHandler(event:FaultEvent):void
{
// TODO Auto-generated method stub
}
protected function newCreationComplete(event:FlexEvent):void
{
httpServiceNews.send();
}
]]>
</fx:Script>
<fx:Declarations>
<s:HTTPService id="httpServiceNews" result="httpServiceNews_resultHandler(event)"
fault="httpServiceNews_faultHandler(event)" resultFormat="e4x"
url="http://www.bbc.co.uk/hindi/index.xml" />
</fx:Declarations>
<s:List dataProvider="{new ArrayCollection(newsCollection)}" width="100%" height="100%"
click="newsListSelectedIndexChanged(event)" >
<s:itemRenderer>
<fx:Component>
<s:IconItemRenderer
iconFunction="newsIconFunction"
messageField="summary"
labelFunction="myLabelFunction"
messageStyleName="messageStyle">
<fx:Script>
<![CDATA[
protected function myLabelFunction(item:Object):String{
return item.title;
}
protected function newsIconFunction(item:Object):String{
return item.imageUrl;
}
]]>
</fx:Script>
</s:IconItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:List>
</s:View>
`
爲紐帶建議,我只能用文本區域或的TextInput但我目前使用IconItemRenderer它使用StyleableTextField,並針對該方案是行不通的。我是否必須創建自己的渲染器? – user1325394 2012-04-30 10:49:12