Supporting Multiple Screen in Android:
i developed one android application few days before..but the application screen is fit in only larger mobile ..i run that application in small screen the pixel is not good ..so i use developer.android.com to learn how to develop on android .apk application it can support all screen size without damaging the pixel or4 density of the screen
the things we have to remember when we are developing mobile application there is different screen size mobile are available in market ..so before developing application to decide which are devices your application is support ..
in android screen support:
android groups all mobile screen size in to four groups
Screen Size :
1 small
2 medium
3 large
4 extra large
Screen Density
low density(ldpi) -120 dpi
medium density (mdpi) -160dpi
high density(hdpi) -240dpi
x high density(xhdpi) -320dpi
Resolution
the total number of pixcel in the screen ..in android multable screen does not support i resolution .it consider only screen size and screen density
do you want find the pixel for equivalent decimal(dp)
the inches is define foe screen size 1inches =2.54
each design requires minimum amount of space in memory.. the minimum size of screen is given by the dp value.. if you want to change this in pixel use the above formula
for archiving this multiple screen application support you can provide alter native layout for different screen size and alternative bitmap images for different density..
Diffrent layout for diffrent screen size
it same like CSS when applying styles in our web application .in android styles and theme are used to apply colors layout styles in to your activity..
it allow get content from design..
Using the style in Your View and ViewGroup Activity in Android Layout
<TextView
style="@style/Mono"
android:Text="@string/hello" >
Define the style in res/Values inside that strings.xml file .the file is applied at compile time of your application..
after i learning this my application is support all screen size of android device...
i developed one android application few days before..but the application screen is fit in only larger mobile ..i run that application in small screen the pixel is not good ..so i use developer.android.com to learn how to develop on android .apk application it can support all screen size without damaging the pixel or4 density of the screen
the things we have to remember when we are developing mobile application there is different screen size mobile are available in market ..so before developing application to decide which are devices your application is support ..
in android screen support:
android groups all mobile screen size in to four groups
Screen Size :
1 small
2 medium
3 large
4 extra large
Screen Density
low density(ldpi) -120 dpi
medium density (mdpi) -160dpi
high density(hdpi) -240dpi
x high density(xhdpi) -320dpi
Resolution
the total number of pixcel in the screen ..in android multable screen does not support i resolution .it consider only screen size and screen density
- Density-independent pixel (dp)
- A virtual pixel unit that you should use when defining UI layout, to express layout dimensions or position in a density-independent way.
do you want find the pixel for equivalent decimal(dp)
px = dp * (dpi / 160)the inches is define foe screen size 1inches =2.54
each design requires minimum amount of space in memory.. the minimum size of screen is given by the dp value.. if you want to change this in pixel use the above formula
- xlarge screens are at least 960dp x 720dp
- large screens are at least 640dp x 480dp
- normal screens are at least 470dp x 320dp
- small screens are at least 426dp x 320dp
for archiving this multiple screen application support you can provide alter native layout for different screen size and alternative bitmap images for different density..
Diffrent layout for diffrent screen size
res/layout/my_layout.xml // layout for normal screen size ("default")
res/layout-small/my_layout.xml // layout for small screen size
res/layout-large/my_layout.xml // layout for large screen size
res/layout-xlarge/my_layout.xml // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml
to store bitmap image i diffrent density ..
res/drawable-mdpi/my_icon.png // bitmap for medium density
2 res/drawable-hdpi/my_icon.png // bitmap for high density
3 res/drawable-xhdpi/my_icon.png // bitmap for extra high density
after creating the above files.. your application is ready to run in a different screen size device .at run time of your application it loads current configuration loads the associate resources for running the application ..
Styles and theme in Android :
it same like CSS when applying styles in our web application .in android styles and theme are used to apply colors layout styles in to your activity..
it allow get content from design..
Using the style in Your View and ViewGroup Activity in Android Layout
<TextView
style="@style/Mono"
android:Text="@string/hello" >
Define the style in res/Values inside that strings.xml file .the file is applied at compile time of your application..
<resources> <style name="MONO" parent="@android:style/TextAppearance.Medium">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#000F00</item>
<item name="android:typeface">monospace</item> </style>
</resources>
this is only for single view you also apply them for entire Activity and Aplication.
for application you aply your theme
<application android:theme="@style/YourTheme">
apply theme for your Activity
<activity Android:theme="@style/theme">
apply parent theme to your theme in Manifest.xml file
for more information about applying theme and activity in your Application refere the following link
after i learning this my application is support all screen size of android device...
No comments:
Post a Comment