Android supports a stretchable bitmap image. This is a PNG image in which you define stretchable sections that Android will resize to fit the object at display time to accommodate variable sized sections, such as text strings. You typically assign this resource to the View's background. An example use of a stretchable image is the button backgrounds that Android uses; buttons must stretch to accommodate strings of various lengths.
A NinePatch drawing is a standard PNG image that includes a 1 pixel wide border. This border is used to define the stretchable and static areas of the screen. You indicate a stretchable section by drawing one or more 1 pixel wide black lines in the left or top part of this border. You can have as many stretchable sections as you want. The relative size of the stretchable sections stays the same, so the largest sections always remain the largest.
You can also define an optional drawable section of the image (effectively, the padding lines) by drawing a line on the right and bottom lines. If you do not draw these lines, the first top and left lines will be used.
If a View object sets this graphic as a background and then specifies the View object's text, it will stretch itself so that all the text fits inside the area designated by the right and bottom lines (if included, the first top and left lines otherwise). If the padding lines are not included, Android uses the left and top lines to define the writeable area.
Here is a sample NinePatch file used to define a button.
This ninepatch uses one single stretchable area, and it also defines a drawable area.
Here are two buttons based on this graphic. Notice how the width and height of the button varies with the text, and the background image stretches to accommodate it.
Source file format: PNG -- one resource per file
Resource source file location: res/drawable/somename.9.png (must end in .9.png)
Status Bar와 Title Bar가 모두 없는 상태
<activity android:name=".MyMainClass"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.FullScreen">
Title Bar가 모두 없는 상태
<activity android:name=".MyMainClass"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
어느 날 대통령이 헬기를 타고 시가지를 돌아보고 있었다.
옆에 있던 비서실장이 만 원 짜리 한 장을 꺼내보이며 말했다.
"각하, 이 돈을 천원짜리 열 장으로 바꿔 뿌리면 열 명의 국민이 기뻐할 겁니다."
그 말을 들은 대통령은 웃으면서 화답했다.
"그럼 백 원짜리 백 개를 뿌리면 백 명의 국민들이 기뻐하겠군!"
그러자 앞에 있던 조종사가 뒤를 돌아보며 말했다.
"제가 지금 이 헬기를 추락시킨다면 전국민이 기뻐할 겁니다."