質問がはっきりとわかりませんでした。ここでの目標は何ですか?
tileMode でグラデーション画像 (.png .jpg など) を使用していますか?
または、透明なアイコンを使用して背景をグラデーションにしていますか?
また、tileMode を使用しているときに重力が必要になるのはなぜですか? tileMode は、ビットマップの全領域を同じ画像でタイル化することを意味します。画像全体に対してそれを行うため、その画像全体が塗りつぶされるため、その画像に重力を与える意味はありません。
画面の一部でこの描画可能なビットマップを使用することが目標である場合は、これをレイアウトに追加します。
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/mydrawablebitmap"
android:id="@+id/imageview1" />
それをlayout.xmlに配置して、独自の幅と高さを設定し、好きなように配置できます。
目標が画像を使用してその背景を作成することである場合は、次のようにします。
drawable フォルダーに gradient.xml を作成します。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#E0E0E0"
android:endColor="#FFFFFF"
android:angle="-90"/>
</shape>
次に、このイメージビューをレイアウトに追加します。
<ImageView
android:id="@+id/myimagewithgradientbackground"
android:layout_width="match_parent"
android:layout_height="160dp"
android:background="@drawable/gradient"
android:src="@drawable/foregroundimage" />
質問の詳細を教えていただければ、それに応じて回答を編集します。