I am attempting to use a 9 patch graphic image as a background with a border
around a row of buttons. When I put this 9 patch image in my layout the
result is that the 9 patch graphic expands to fill the entire screen and the
other elements of the layout that are below this can no longer be seen.
I previously had a similar issue when I used a 9 patch graphic image as a
custom image for a progress bar, to allow the bar to size properly
regardless of the screen width. I finally found a solution to that issue by
changing the progress bar <layer-list> drawable to use a <clip> element to
contain the 9 patch graphic drawable as follows:
<?xml version="1.0" encoding="UTF-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android"
>
<item
android:id="@+android:id/background"
android:drawable="@drawable/progress_bar_background" />
<item
android:id="@+android:id/SecondaryProgress"
android:drawable="@drawable/progress_bar_background" />
<item
android:id="@+android:id/progress" >
<clip android:drawable="@drawable/progress_bar_blue" />
</item>
</layer-list>
Apparently putting the drawable inside the clip element prevented it from
expanding to fill the entire screen.
Is there a similar setting that I need to use in my screen layout to prevent
the 9 patch graphic from expanding to maximum size? The section from the
layout code I am using is the following:
...
<RelativeLayout
android:id="@+id/button_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title_bar"
android:background="@color/button_bar_background"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="@drawable/button_bar_border_background"
>
<RadioGroup
android:id="@+id/radio_buttons"
android:layout_width="wrap_content"
android:layout_height="@dimen/radio_button_height"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
...
In addition to the specific layout setting that I need you use, if you
understand how the 9 patch graphic images get expanded and what the clip
option does, and brief explanation would be very helpful.
Thanks
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en