2011-05-03 79 views
2

Iam構建自定義評分欄。在kozyr的文章的幫助下,我創建了它。 但我有不同的圖像縮放尺寸不同的屏幕類型的問題。 下面我提供圖像,左邊是我的自定義評級欄的截圖,右邊是簡單的imageview。 這是用於HVGA屏幕。Android自定義評分欄圖片大小問題

link to screenshot

正如你看到的,明星排名的酒吧和ImageView的是相同的

而且從HVGA屏幕這張截圖

another link to the screenshot

的Android莫名其妙地調整大小明星在我的RatingBar 。問題是什麼?!!

下面是代碼

<RatingBar android:id="@+id/rating_lunch" style="@style/starRatingBar" android:layout_width="wrap_content" 
        android:layout_height="wrap_content" android:numStars="5" android:stepSize="1.0"/> 

這裏去的風格:

<style name="starRatingBar" parent="@android:style/Widget.RatingBar"> 
    <item name="android:progressDrawable">@drawable/progress_star_big</item> 
    <item name="android:minHeight">19px</item> 
    <item name="android:maxHeight">19px</item> 
</style> 

回答

2

問題解決了。當我加入

<uses-sdk android:minSdkVersion="4" 
     android:targetSdkVersion="7" /> 

清單文件的一切還好吧成爲)

2

嘗試使用設備無關像素,而不是實際的像素。例如:

<item name="android:maxHeight">19dp</item> 

請參閱the docs關於此主題。

+0

不幸的是,它並沒有幫助 – 2011-05-17 23:38:18