非常に薄い灰色から「ほぼ白」までのグラデーションカラーを作成する方法を見つけようとしています。例として、Android 用の ebuddy を参照できます。あなたの「仲間」はグラデーションカラーのリストにあります。
これはアンドロイドでどのように行われますか? aarrggbb を使用する必要があると思いますよね?
GradientDrawables を作成して Android にグラデーションを作成できます。次に例を示します。
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor="#FF808080"
android:endColor="#FFFFFFFF"
android:angle="270"/>
</shape>
res フォルダの drawable フォルダにこのrectangle.xmlファイルを作成できます:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" type="rectangle">
<gradient android:angle="90" android:startColor="#a3a3a3" android:centerColor="#cfcfcf" android:endColor="#f0f0f0"/>
style.xml ファイルで次のように定義することで、画面の背景として使用できるようになりました。
<style name="screenBackground">
<item name="android:paddingLeft">5dip</item>
<item name="android:paddingTop">2dip</item>
<item name="android:paddingRight">5dip</item>
<item name="android:paddingBottom">2dip</item>
<item name="android:background">@drawable/rectangle</item>
<item name="android:layout_marginBottom">15dp</item>
</style>
これを main.xml ファイルで使用します。
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout android:id="@+id/header"
android:layout_width="fill_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android" style="@style/screenBackground">
// All your other elements in the xml file go here.
</LinearLayout>