2013年6月5日 星期三

[Android] RatingBar在HTC One上的奇怪現象

最近遇到一個超詭異的bug,是RatingBar在HTC One上面會變成這樣:



可是在別的裝置和同一個App其他地方就不會,百思不得其解只好用地毯式搜尋硬找,最後發現原因居然是ListAdapter!

SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to)

這裡的Context不能傳ApplicationContext,一定要傳Activity的Context進來!
因為在別的裝置上沒問題,我只能猜是HTC Sense在下面不知道什麼東西沒改好……orz
CODE { display: block; /* fixes a strange ie margin bug */ font-family: Courier New; font-size: 8pt; overflow:auto; background: #f0f0f0 url(http://klcintw.images.googlepages.com/Code_BG.gif) left top repeat-y; border: 1px solid #ccc; padding: 10px 10px 10px 21px; max-height:200px; height:200px; // for IE6 line-height: 1.2em; } #quote { display: block; /* fixes a strange ie margin bug */ font-family: Verdana; font-size: 10pt; overflow:auto; background: #f7f7f7 url(http://lh5.ggpht.com/_z-VThISftkI/SXUlpyfw9ZI/AAAAAAAABYY/e3GUx9_Z4TE/s288/quote-l.gif) left top no-repeat; border: 4px dotted #ccc; padding: 15px 15px 15px 31px; /*up right bottom left*/ max-height:300px; line-height: 1.2em; }