여러 화면을 지원하는 애플리케이션 스켈레톤
Android에는 기능, 해상도, 화면 크기가 다른 다양한 기기가 함께 제공되므로 여러 (작고 큰) 화면을 지원하는 애플리케이션을 개발하면서 크기와 레이아웃에 장애가 있습니다.
이로 인해 화면 크기, 해상도 및 DPI 의 다양한 조합이 발생하고 Android 장치 용으로 설계 및 개발할 때 상당한 어려움이 발생합니다. 일부 다른 제조업체 (비 Android)는 해상도와 DPI가 다르지만 화면 크기는 동일하고 해상도는 동일한 종횡비를 따릅니다. 따라서 Android가 아닌 장치에 맞게 이미지를 만들 수 있습니다.
내 질문은 요구 사항을 충족하기 위해 따라야하는 적절한 흐름이나 아키텍처가 있다는 것입니다.
크기와 해상도가 다른 태블릿이 있다는 것을 기억하십시오.
나는 것을 알고 있어요 안드로이드 개발자는 이 정보를 포함하지만 내보기 구현에서입니다.
내 지식에서 내가 이해 한 것은 Android 그래픽을 디자인하기 위해 프로그래머조차도 디자인 개념을 알아야한다는 것입니다.
마지막으로 여러 화면의 레이아웃과 아이콘을 처리하는 구조를 만들었습니다.
Android는 다음 두 가지 매개 변수를 기반으로 기기 디스플레이를 카테고리로 일반화합니다.
- 화면 크기, 디스플레이의 물리적 크기 (대각선으로 측정)
- 화면 밀도, 디스플레이의 물리적 픽셀 밀도 (인치당 픽셀 또는 ppi)`
화면 크기와 밀도를 빠르게 확인하려면 Android 용 " What 's my Size "앱을 설치하세요 .
화면 크기
Android는 네 가지 일반화 된 화면 크기를 정의합니다.
Qualifier Size
small ~3 inches (approx)
normal ~4 inches (approx)
large Exceeds 4 inches
xlarge Exceeds 7 inches
- Most phones are classified as small or normal (roughly 3 to 4 inches diagonally). But now, there are many phones with large screen such as Galaxy S4, HTC One, Xperia Z
- A small tablet like the Samsung Galaxy Tab is classified as large (larger than 4 inches)
- Extra-large applies to large devices, for example large tablets
Android defines four generalised screen densities:
Qualifier Description Nominal value
ldpi low density 120 ppi
mdpi medium density 160 ppi
hdpi high density 240 ppi
xhdpi extra high density 320 ppi
Typically:
- screen size has most impact on your app layouts
- screen density has most impact on your image and graphic resources
It is listed here the percentage difference of device screen
- Ldpi- 75%
- Mdpi- 100% (base according to Android developer site)
- Hdpi- 150%
- XHdpi- 200%
But as we know now most of device coming with 480X800 so I'm consider this as based device, so our new calculation will like this
- Ldpi- 50%
- Mdpi- 66.67%
- Hdpi- 100%
- XHdpi- 133.33%
which means that first icon and design will be created for 480X800 only and then for rest ones(i.e. Ldpi, Mdpi, Xhdpi).
There are images which are common for all layout and must uniform in color and shape(no complex shape, no curve) so for this kind of image we are creating 9patch
which to be put in “drawable(no-suffix)” folder. To create 9Patch image you can either use DrawNinePatch or BetterNinePatch
Now just rename your images based on Android's standards and complete your application with hdpi
and then just take drawable-hdpi
folder and Open Adode Photoshop(recommended) create Action of multiple size(just change the size according to percentage ratio) once Action created for all size then just do Batch Automate and give source(drawable-hdpi) and destination(drawable-ldpi, drawable-mdpi, drawable-xdpi).
The reason I insist you to use Photoshop because it will resize automatically your image with Actions and one more plus point is that you need not to rename the file(it will assign same name as original one).
once you completed with creation of all images, refresh your project and test it.
Sometimes there may be possibility that the layout which support screen(xhdpi, hdpi, mdpi) may be get cut in small screen(ldpi) so for handling this just create separate Layout folder(layout-small) for it and add ScrollView
(mostly). Thats it.
Tablet Tablets are categorized into two size.
- 7"(1024X(600-48(navigation bar))) = 1024X552 (drawable-large)
- 10"(1280X(800-48(navigation bar))) = 1280X752 (drawable-xlarge)
In this we need to create image for both the screen and just put them accordingly
So all in all we will have this folder in our application to support multiple screen.
drawable
drawable-ldpi
drawable-mdpi
drawable-hdpi
drawable-xhdpi
drawable-large
drawable-xlarge
will be more qualifier combination with Screen size and Screen density
drawable-large-ldpi
drawable-large-mdpi
drawable-large-hdpi
drawable-large-xhdpi
more qualifier with Screen density and Version
drawable-ldpi-v11
drawable-mdpi-v11
drawable-hdpi-v11
drawable-xhdpi-v11
and more qualifier with Screen size and Version
drawable-large-v11
drawable-xlarge-v11
and more qualifier with Smallest width concept(SW)
drawable-sw???dp
Further more in Android V3.0 Honeycomb they introduced new concept of SW(smallest width)
in which device are categorized into screen width, so if we are creating a folder named drawable-sw360dp
then the device with 720dp(either width or height) will use resource from the this folder.
for example to find the Samsung Galaxy S3
dp to suffix to drawable-sw?dp
With reference of DP Calculation, If you want to support your layout or drawable to S3 then the calculation says
px= Device's width = 720
dpi= Device's density= 320
formula given
px = dp * (dpi / 160)
interchanging formula because we have px's value
dp = px / (dpi / 160)
now putting value,
dp= 720 / (320/160);
dp=360.
so drawable-sw360dp
will do the job
Get you Device configuaration from GsmArena Sameway you can also create folder according to Device's Android API version i.e. drawable-hdpi-v11` so the device which is having API11 and it is Hdpi then it will use this resources.
Additional Tips:
Use relative layouts, dp, sp, and mm
dp units - device independent pixels normalised to 1 physical pixel on a 160 ppi screen i.e. medium density. Scaled at runtime. Use for screen element dimensions
sp units - scaled pixels, specified as floating point values, based on dp units but additionally scaled for the user's font-size preference setting. Scaled at runtime. Use for font sizes
you should always use RelativeLayout for layouts; AbsoluteLayout is deprecated and should not be used.
Use appropriate image formats - PNG versus JPEG
Android "prefers" PNG for bitmap image files, "accepts" JPEG, and "discourages" GIF.
However, PNG and JPEG are not equivalents. They have different quality trade offs, and PNG is not always best:
JPEG can offer up to 50% file-size reductions over PNG, which is significant if your app is image-intensive
A higher quality "lossy" JPEG may look better than a highly compressed "lossless" PNG, for the same file size
Add labels to your images and graphics for debugging
Use the supports-screens element
Configure your emulators with real device values
Conventionally, desktop systems display at 72ppi (Mac), or 96ppi (Windows, Linux). Compared with mobile, desktop displays are always low density.
Always configure your Android emulators to mimic real device values, and always set them to scale to emulate device density.
In Eclipse, it's easy to create multiple emulators (from the Eclipse menu bar, select Window > AVD Manager > New) configured with values for real devices:
Name the emulator for the real device it's emulating Specify Resolution, don't use Built-in generic sizes Set the device density to match the real device (in the Hardware pane set Abstracted LCD Property to the real density, always an integer value)
When you launch the device, always select Scale display to real size, and type in the real screen dimension in inches.
If you don't set the device density, the emulator defaults to low density, and always loads ldpi-specific resources. Resolution (pixel dimensions) will be correct, but your density-dependent image resources will not display as intended.
Of course, nothing you do will reproduce higher density image quality on a lower density desktop display.
Here is the Data collected during a 7-day period ending on October 1, 2012. To see the latest statistic about Android platform version, go to here
Based on Screen Size
Based on Screen Density
Designers should create base designs of
base size of mdpi devices * density conversion factor of highest supported density bucket
size.Base screen size is 320 X 480 px and density buckets are as follows:
- ldpi: 0.75
- mdpi: 1.0 (base density)
- hdpi: 1.5
- xhdpi: 2.0
- xxhdpi: 3.0
- xxxhdpi: 4.0
And to tackle extra available space on Android devices should use stretchable components in both the directions (horizontally and vertically). Detailed info is available here:
http://vinsol.com/blog/2014/11/20/tips-for-designers-from-a-developer/
참고 URL : https://stackoverflow.com/questions/12242111/application-skeleton-to-support-multiple-screens
'Programing' 카테고리의 다른 글
DataGridview-첫 번째 열 앞 부분 제거 (0) | 2020.09.07 |
---|---|
Twig에서 나무를 렌더링하는 방법 (0) | 2020.09.07 |
Ruby에서 SOAP를 사용하는 가장 좋은 방법은 무엇입니까? (0) | 2020.09.06 |
Ruby on Rails에서 두 날짜 사이의 개월 수 찾기 (0) | 2020.09.06 |
Java에서 이름으로 클래스를 인스턴스화하는 방법이 있습니까? (0) | 2020.09.06 |