Question

Je cherche à ajouter un fond bruyant dans mon application Android. La texture est parfaite et je peux créer une image NinePatch, mais lorsque je l'utilise réellement dans l'application, il étire en provoquant des lignes sur tout l'arrière-plan. Une idée de quelle meilleure façon de mettre en œuvre ce type de texture?

Je chercherais également à utiliser quelque chose de similaire pour la barre d'action.

NoisyGrey

Était-ce utile?

La solution

9-Patch s'étirera, vous devez spécifier quelle zone devrait s'étirer dans l'image. Pourquoi n'essayez-vous pas de répéter votre dessin. ainsi:

<xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/YourLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/backrepeat"
>

puis dans un XML appelé backrepeat.xml

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/back" 
    android:tileMode="repeat" />
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top