Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 683
chengbo Avatar asked Dec 19 '12 01:12

chengbo


People also ask

What is 9 patch image in Android?

The Draw 9-patch tool is a WYSIWYG editor included in Android Studio that allows you to create bitmap images that automatically resize to accommodate the contents of the view and the size of the screen. Selected parts of the image are scaled horizontally or vertically based on indicators drawn within the image.

What is NinePatch?

android.graphics.NinePatch. The NinePatch class permits drawing a bitmap in nine or more sections. Essentially, it allows the creation of custom graphics that will scale the way that you define, when content added within the image exceeds the normal bounds of the graphic.

What is a 9 PNG file?

A 9 patch image is a regular png (. PNG) image which is needful for android app developers where they require to wrap any content within a background image without pixelating the background image.


2 Answers

It's too support layout bounds.

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

like image 117
Tor Norbye Avatar answered Sep 21 '22 15:09

Tor Norbye


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.

like image 24
Abhishek Sabbarwal Avatar answered Sep 22 '22 15:09

Abhishek Sabbarwal