Android でカスタム評価バーを作成しましたが、下位レベルの API を使用するデバイスで問題が発生しています。ICSを使用してhtc one xに正常に実装しましたが、android 2.2を使用したhtcの欲求では、画像間にアーティファクトがあります。画面密度ごとに png リソースを作成しました。
これは、hdpi画面を使用したhtcの欲望の画像です。
これは、xhdpi スクリーンを使用した htc one x の画像です。
以下は私のレイアウトファイルに含まれています: 以下は私の描画可能なリソースです:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+android:id/background"
android:drawable="@drawable/bone_empty" />
<item android:id="@+android:id/progress"
android:drawable="@drawable/bone_full" />
</layer-list>
そして、以下は私の res/values-hdpi/styles.xml です (htc Desire で使用)
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="dogBar" parent="@android:style/Widget.RatingBar">
<item name="android:progressDrawable">@drawable/dog_rating_bar</item>
<item name="android:minHeight">48dp</item>
<item name="android:maxHeight">48dp</item>
</style>
</resources>
そして、以下は私の res/values-xhdpi/styles.xml です (htc one x で使用)
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="dogBar" parent="@android:style/Widget.RatingBar">
<item name="android:progressDrawable">@drawable/dog_rating_bar</item>
<item name="android:minHeight">64dp</item>
<item name="android:maxHeight">64dp</item>
</style>
</resources>