網(wǎng)站:
JavaEye
作者:
iwinyeah
鏈接:
http://iwinyeah.javaeye.com/blog/168955
發(fā)表時(shí)間: 2008年03月07日
聲明:本文系JavaEye網(wǎng)站發(fā)布的原創(chuàng)博客文章,未經(jīng)作者書(shū)面許可,嚴(yán)禁任何網(wǎng)站轉(zhuǎn)載本文,否則必將追究法律責(zé)任!
以下代碼由bm.core.tools.DeviceInfo.java抽出,詳見(jiàn)該文件
private void testFontListBug()
{
if( isNokia() )
{
// 就算是Nokia的設(shè)備也要進(jìn)行一下測(cè)試來(lái)確定是否有這個(gè)Bug
final Font font = Font.getFont(
Font.FACE_PROPORTIONAL,
Font.STYLE_PLAIN,
Font.SIZE_SMALL
);
final List list = new List( "", List.IMPLICIT );
for( int i = 0; i < 3; i++ )
{
list.append( "", null );
}
for( int i = 0; i < 3; i++ )
{
list.setFont( i, font );
}
list.deleteAll();
try
{
for( int i = 0; i < 4; i++ )
{
list.append( "", null );
}
listFontBug = false;
}
catch( Throwable e )
{
listFontBug = true;
}
}
else
{
// 除Nokia設(shè)備外,其它設(shè)備都假定它有這個(gè)Bug
// 不知道實(shí)際上是不是這樣呢?我估計(jì)大部分的手機(jī)都有這個(gè)問(wèn)題
// 不然他不會(huì)這么做
listFontBug = true;
}
}
那么這個(gè)Bug是什么呢?
我在bm.mvc.ListBrowserView中找到如下代碼:
if( !DeviceInfo.getDeviceInfo().hasListFontBug() )
{
final int itemCount = list.size();
for( int i = 0; i < itemCount; i++ )
{
list.setFont( i, Util.SMALL_FONT );
}
}
也就是說(shuō),有這個(gè)Bug的設(shè)備不能將List的項(xiàng)的字體更改為SMALL_FONT
本文的討論也很精彩,瀏覽討論>>
JavaEye推薦
文章來(lái)源:
http://iwinyeah.javaeye.com/blog/168955