我正在使用 flash builder 4.6 为 android 构建应用程序。我正在尝试在此 xml “http://www.bbc.co.uk/hindi/index.xml”中显示 unicode 字符
在 flash builder 提供的模拟器上运行时字符显示正确,但在 android 上安装时显示方框 [][][][][][][][][]。我该如何解决这个问题,以便正确嵌入字体?
我测试的 android 版本是 2.3.5。我的代码如下`
<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").@url;
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>
`