Skip to content

Chris' Laboratory

chrislee.kr – Personal blog as bookshelves

Menu
  • Home
  • Github
  • Contact Me
Menu

Support various screen-size in the Android UI – AndroidPub

Posted on 01/01/201109/04/2011 by Chris Lee
Read Time:1 Minute, 39 Second
Reference : [안드앱콘1] 다양한 스크린 사이즈에서의 UI 처리 http://www.androidpub.com/?mid=android_dev_info&category=127161& amp;page=4&document_srl=320322
Points
– Handle resource by folder names
  • res/layout/my_layout.xml: Normal screen-size layout
  • res/layout-small/my_layout.xml: Small screen-size layout
  • res/layout-large/my_layout.xml: Large screen-size layout
  • res/drawable-ldpi/my_icon.png: Icons for low density
  • res/drawable-mdpi/dpi/my_icon.png: Icons for medium density
  • res/drawable-hdpi/my_icon.png: Icons for high density
  • res/drawable-nodpi/composite.xml: Resources that unrelated with density
– Do we need to generate different resources for all devices?
  • DIP: Density Independent Pixel: Ensure compatibilities for different devices
  • QVGA – 320dip.426dip
  • HVGA – 320dip,480dip
  • WVGA854 – 320dip,569dip
  • Suggestion: Design layout using only DIP in HVGA normal screen.
  • Easy to understand due to equal (1:1) px and dip
– Use “RelativeLayout”

– Resource folders for bitmap resolution
  • drawable: xml drawable files which unrelate with resolution
  • drawable-ldpi: image files for low density, automatically adjust bimap size, can be the bimap cloudy sometimes.
  • drawable-mdpi: image files for medium density
  • drawable-hdpi: image files for high density
– Tip 2: Make bitmap based on HDPI
  • It is good practice for auto-size adjustment.
– Pre-Scaling
  • Scale the size during loading time.
  • Advantages for CPU
  • Example: If the 100×100 icon in “res/drawable-mdpi/” is loaded in the “High Density” screen, Android stretches the icon’s size to 150×150.
– Auto-Scaling
  • Scale the size during drawing.
  • Advantages for Memory
  • Automatically scale the size based on each density when bitmap is drawing in Canvas.
– Apply Bitmap
  • Bitmap resources are applying to each screen judiciously.
  • If you want to make a bitmap, then create HDPI density image.
  • If memory is low, then consider auto-scaling. If CPU is low, then consider pre-scaling.
– AndroidManifest.xml
<supports-screens
android:largeScreens=”true”
android:normalScreens=”true”
android:smallScreens=”true”
android:resizable=”true”
android:anyDensity=”true” />
</manifest>

Share

Facebook
Twitter
LinkedIn
Email

Related

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

  • Databases (11)
    • MongoDB (4)
    • MS-SQL (1)
    • MySQL (6)
  • E-Commerce (8)
    • Magento (8)
  • Finance (2)
  • Frameworks (84)
    • Adobe Flex (1)
    • Angular (ngx) (3)
    • Codeigniter (6)
    • CSS (5)
    • Django (2)
    • Javascript (13)
    • Node.js (6)
    • PHP (17)
    • React Native (4)
    • React.js (1)
    • Sencha Touch (4)
    • Terraform (1)
    • Vue.js (1)
    • WordPress (4)
    • Yii2 (3)
  • General Documents (15)
  • Marketing (3)
  • Mobile Development (33)
    • Android (20)
    • iPhone (13)
  • Platforms (21)
    • Arduino (2)
    • Docker (5)
    • Google App Engine (5)
    • Raspberry Pi (5)
    • Samsung Smart TV (4)
  • Security (17)
  • Server (31)
    • Linux (13)
  • Tools (14)
    • SVN (7)
  • Uncategorized (3)

Search

Recent Posts

  • helm list error stream ID 3; INTERNAL_ERROR
  • Bootstrapping Kubernetes cluster with kubeadm
  • Taint all resources in the one module
  • Alpine – Plugin caching_sha2_password could not be loaded
  • npm link with peerDependencies

Recent Comments

  • Obayed on Binance Auto Trading Bot – Buy low/Sell high with stop loss limit/Trade multiple coins
  • Ari on How to install memcache.so/memcached.so for MAMP Pro (Mac)
  • Mida ali on Binance Auto Trading Bot – Buy low/Sell high with stop loss limit/Trade multiple coins
  • Chris Lee on How to install memcache.so/memcached.so for MAMP Pro (Mac)
  • Chris Lee on Setting Up A VPN Server On OSX 10.6

Tags

1 ajax amazon android android-addpart browser chrislee-kr codeigniter codeigniter-tcpdf com-apple-net-racoon CSS CSS history hack delpaigmail-com entity-addpart-double exception-printing-is-disabled-by-default-for-security-reasons ext-plugins-listpagingplugin ext-plugins-listpagingplugin-example f iphone javascript jquery-defaultchecked jquery-samsung-smart-tv listpagingplugin mac magento-exception-printing-is-disabled-by-default-for-security-reasons magento-sample-data-exception-printing-is-disabled-by-default-for-security-reasons nu-vot null-core-errors-confignotfound-config-mk9engine-ini php samsung-smart-tv-jquery samsung-smart-tv-sdk-ajax samsung-smart-tv-sdk-jquery samsung-tv-sdk samsung-tv-sdk-jquery samsung tv sencha-smart-tv sencha-touch-list-paging smart-tv-jquery sqlite subversion svn tcedook tcpdf-codeigniter uilinebreakmodecharacterwrap-is-deprecated unknown-column-link-area

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
© 2023 Chris' Laboratory | Powered by Minimalist Blog WordPress Theme