android


Why do I need a different dimension file for different screen sizes?


Consider a case where I have two devices : A phone and a tablet.
I create a view using 'dp' for specifying the sizes.
Now, why does it not appear the same in both cases as dp is calculates the pixel value depending upon density.
Is the pixel size same for every device, eg. TV or phone or tablet. If no, then dp should work for all the devices with same value. There should not be need to give the specs in a separate xml file.
What you say is correct. If you use dp to define the view sizes of elements such as LinearLayout, ImageView, etc, etc, you will get similar aspect in every device. That is becuause the size of the pixel is going to be scaled properly depending on each device pixel density.
But, the thing is that not every device has the same aspect ratio. This is, you may use a xml layout file for general smpartphones and everything is going to be allright (almost) but if you use the same xml file for a tablet it will look rather funny. And that is because the screen is much wider than a smartphone, so your layout need to be "rethinked". The elements has been correctly reescaled but they dont fit good in a very diferent screen like a TV or a tablet. That is because there are a lot of pixels more that need to be filled with view elements.

Related Links

Is Android Widget ID persistent
Right to Left support for TextView in Android
Android detecting on touch inside fragment
How to Prevent an Alert Dialog Getting Closed by Back Button
Emulator of specific device
how to make application with android
Exit Button on App? App Still Running?
Set the background colour of a Layout view to a gradient in Android?
How to display data between two dates based on android spinners selected item from sqlite db?
How to programmatically draw smooth stroke around a button in Android?
How to kill app on button press
How to Pass Class to ImageSwitcher in Android?
High-performance bitmap drawing from Webview
ContentObserver for Camera Button?
Easiest secure Android server backend
Android: Debug vs. Release (SDK) performance

Categories

HOME
uml
wakanda
amp-html
saml-2.0
jwplayer
error-handling
grafana
static-site
entity-framework-core
telegram-bot
onclick
code-coverage
google-cloud-datalab
nfs
character
rcloud
octave
google-chrome-app
dkim
appcelerator-studio
plist
x-cart
automatic-ref-counting
renjin
3nf
aws-sdk
red5
template-engine
symfony-console
swagger-2.0
google-maps-autocomplete
ksh
named-entity-recognition
aggregation
flask-sqlalchemy
onload
pylons
licensing
datastax-enterprise-graph
tpm
google-earth
volatile
recurring-events
left-join
dumpbin
simplecv
hreflang
joomla2.5
carriage-return
python-import
watchman
ideascript
android-augmented-reality
release
sim-card
jvmti
p4merge
vmware-fusion
laravel-elixir
glm-math
android-checkbox
importerror
wc
rfc3339
trojan
carrot2
arq
context-sensitive-grammar
arules
quicktime
css-transforms
lsyncd
d3-force-directed
google-photos
shinobi
model-associations
drawstring
dimension
android-wake-lock
kango-framework
false-sharing
cycle2
jparsec
httpruntime.cache
tfs-workitem
ess
omnifaces
aspectj-maven-plugin
kubuntu
apache-spark-1.3
showdialog
webmatrix-3
boost-program-options
jbake
post-commit-hook
cocos3d
rickshaw
nsmenu
xml-namespaces
matrix-inverse
draw2d-js
paste
koala
openargs
ice-cube
ebay-lms
printdialog
mongohq
gpars
node-blade
dolby-audio-api
diem
pdfviewer
dopostback
extconf.rb
fusefabric
apache-whirr
usertype
isa-swizzling
expression-blend-4
saxparseexception
promotion-code
matlab-load
tournament
squishit
updatesourcetrigger
dot-emacs
message-passing
sifr
filesystemobject
web-application-project
software-lifecycle
information-management

Resources

Encrypt Message