Meaning of red color in Android's Nine-patch drawables
Asked Answered
L

4

21

According to the Android documentation, we know that the left and top black line define the stretchable area, and the bottom and right line define the content area.

It's easy to understand, but I found the below image named textfield_activated_holo_dark.9.png from android-17 framework. What is the purpose of the red colors in the lower-left, lower-right and top-right corners?

enter image description here

Lovato answered 19/12, 2012 at 1:3 Comment(0)
I
5

I believe this thread has some discussion on the same topic.

This has got something to do with setting layout bounds and I believe its not documented yet.

Incommode answered 19/12, 2012 at 1:35 Comment(1)
Thank you actually :) This was something new for me as well. Glad that we both now know something about it :)Incommode
C
6

It's too support layout bounds.

See https://groups.google.com/d/msg/adt-dev/z_iLJWyDQdo/lf4sR6CRl2cJ for more info.

Compelling answered 18/2, 2013 at 17:11 Comment(0)
I
5

I believe this thread has some discussion on the same topic.

This has got something to do with setting layout bounds and I believe its not documented yet.

Incommode answered 19/12, 2012 at 1:35 Comment(1)
Thank you actually :) This was something new for me as well. Glad that we both now know something about it :)Incommode
H
1

The red lines are how you define optical bounds on a nine-patch. This feature was officially added in Android 4.3 but to date, its still not available in the support library. Read more about them in the 4.3 release notes:

http://developer.android.com/about/versions/android-4.3.html#UI

Heintz answered 9/3, 2014 at 2:8 Comment(1)
+1 for mentioning what they are, without me having to click off-siteUnscramble
P
1

If you are using optical bounds, you should take in account a little bug introduced with gradle 0.9.1 plug-in, For a work around First in this issue report: https://code.google.com/p/android/issues/detail?id=67376 In this you can see that using gradle plug-in 0.9.1 makes PNG crash on GB and it states that the work around is use 0.9.0 instead. But that not nice either, in the release notes of 0.9.1 the android team states that you should use the old PNG cruncher: http://tools.android.com/tech-docs/new-build-system

I have test both solutions and both are OK, i thing the second one is better, its your choice

Pachysandra answered 22/3, 2014 at 16:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.