Salut J'essaie de créer un fond drawable
pour mon écran de démarrage que je vais définir dans le thème lui-même. Mais le drawable bitmap utilisé pour rester au centre est en train de s'étirer et je n'arrive pas à comprendre comment le garder normal. Voici mon code drawable: splash_screen_bg.xmlcréation d'arrière-plan drawable en utilisant layer-list, icône se étirant
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="360"
android:centerColor="@color/colorAccentXDark"
android:endColor="@color/Black"
android:gradientRadius="500dp"
android:startColor="@color/colorAccentXDark"
android:type="radial"
android:useLevel="false" />
</shape>
</item>
<item
android:bottom="50dp"
android:top="50dp">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="500dp"
android:innerRadiusRatio="1"
android:shape="oval">
<gradient
android:angle="360"
android:centerColor="@color/colorAccentXDark"
android:endColor="@color/colorAccentXDark"
android:gradientRadius="400dp"
android:startColor="@color/colorAccent"
android:type="radial"
android:useLevel="false" />
</shape>
</item>
<item android:gravity="center">
<bitmap android:src="@drawable/ty_logo" />
</item>
</layer-list>
Voici le code où je suis en train de ce drawable comme arrière-plan d'une activité:
<style name="TYTheme" parent="SearchActivityTheme.NoActionBar">
<item name="colorPrimaryDark">@color/colorAccentXDark</item>
<item name="android:alertDialogTheme">@style/AlertDialogTheme</item>
<item name="android:windowBackground">@drawable/splash_screen_bg</item>
</style>
Voici le bitmap drawable ty_logo
est un png
est étiré dans mon téléphone. Comme il n'y a pas d'option scaleType
avec bitmapDrawable
je ne sais pas comment le gérer.
Avez-vous trouvé une réponse à cette question? J'ai le même problème en ce moment et je ne trouve pas de solution. – baal
n'a pas encore trouvé la solution. – himanshu1496