2011-05-03 80 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