アプリの背景にグラデーションを使用して xml ファイルを作成し、同時にロゴを入れる方法はありますか。
そのため、レイアウトの背景を設定すると、ロゴのグラデーションが表示されます。
もちろん、グラデーションを定義して、すべてのページにロゴをドロップすることもできますが、私がより良い方法で達成したいのではありませんか?
xml ファイルで両方を結合しようとしましたが、うまくいかず、アプリがクラッシュしました。
xml とロゴで作成したグラデーションは、画像 1 つで 1 つの xml ファイルにして、すべてのページで使用します。background.xml のロゴを変更すると、他のすべてのページでロゴを変更する必要があります。
次の xml をすべてのレイアウトの背景として使用したい
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor="#000"
android:endColor="#008d36"
android:gradientRadius="326"
android:type="radial"/>
</shape>
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginRight="18dp"
android:layout_marginTop="89dp"
android:layout_toLeftOf="@+id/logo"
android:src="@drawable/logo" />