Hello,
Apologies for not being clear when I asked the question. Not so long ago
there was a thread on this mailing list (entitled "EditText with tiled background")
where the OP wanted to draw lines below an edit text to be used as a notepad
and the lines were repeating. The response was the following code, but I cannot
get it to work. If I place just the <bitmap> code inside background.xml then I can
see the repeating bitmap. I must admit I am having some trouble unerstanding
the <layer-list> element. Why do I need a list of drawables drawn from top to
bottom?
I need a repeating image that repeats, not stretches, and it seems 9Slice only
stretches images?
Thanks for your help,
John Goche
main.xml: ---------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:gravity="center_horizontal">
<TextView
android:background="@drawable/background"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>
drawables/background.xml : -------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<clip>
<shape>
<gradient
android:startColor="#FF5e8ea3"
android:centerColor="#FF32a0d2"
android:centerY="0.1"
android:endColor="#FF13729e"
android:angle="270"
/>
</shape>
</clip>
</item>
<item>
<clip>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/bg"
android:tileMode="repeat"
android:antialias="true"
android:dither="false"
android:filter="false"
android:gravity="left" />
</clip>
</item>
</layer-list>
On Mon, Oct 3, 2011 at 8:11 PM, rich friedel <rich.friedel@gmail.com> wrote:
-- Yes --On Mon, Oct 3, 2011 at 5:19 PM, John Goche <johngoche99@googlemail.com> wrote:
Hello,
I would like to have the top middle part of a nine-Slice image
repeat and the rest to remain fixed. Is this possible?
Thanks,
John Goche
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment