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

Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187
chengbo
  • 5,789
  • 4
  • 27
  • 41

4 Answers4

6

It's too support layout bounds.

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

Tor Norbye
  • 9,062
  • 3
  • 29
  • 24
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.

Community
  • 1
  • 1
Abhishek Sabbarwal
  • 3,758
  • 1
  • 26
  • 41
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

JustinMorris
  • 7,259
  • 3
  • 30
  • 36
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

JavierSP1209
  • 899
  • 8
  • 17