Android でビットマップの色を変更する方法を見つける必要があります。値に応じて、アプリケーションで楕円形の画像の色をスムーズに置換/変更する必要がありint
ます。myValue=5
画像の色を に変更し、色を に変更する場合RED
のようなものが必要です。私がこれを行うことができる唯一の方法は、次のようなxmlファイルを使用することでした:myValue=322
BLUE
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" android:padding="10dp">
<!-- you can use any color you want I used here gray color-->
<solid android:color="#cccccc"/>
<corners
android:bottomRightRadius="10dp"
android:bottomLeftRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp"/>
</shape>
その後、画像リソースmyValue
を設定するように変更されます。ImageView
しかし、この方法では、35 の異なる xml ファイルを作成する必要があります...これは良い考えではないと思います。
これを行うためのより良い解決策を提案できる人はいますか?