TransitionDrawable with nine patches - margin is wrong

I have a TransitionDrawable. Both states are both nine patches and a content area. The problem is that the margin is simply too high - in fact, it is basically twice as much as it should be. It seems he is adding up the fields of two nine patches.

Margin works the way it should work if I installed one of these nine patches directly as a background and did not use TransitionDrawable, so nine patches are definitely true.

Has anyone encountered such a problem?

EDIT: if I set the content area to the full size of the resource and define the addition in xml, it works. OTherwise will always be wrong. This seems like a bug in Android, so this is the only solution, but there may be a more convenient way around this: /

+5
source share
1 answer

Yes you are right. Annoying.

As you said, I use hardcoded negative strips to compensate for the first_nine_patch9-patch padding so far.

<?xml version="1.0" encoding="UTF-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/first_nine_patch" />
    <item android:drawable="@drawable/second_nine_patch"
        android:top="-7dp"
        android:right="-16dp"
        android:bottom="-8dp"
        android:left="-4dp" >
    </item>
</transition>
+3
source

All Articles