Assume that I am defining a button or text view width as 100 dip and height as 30 dip in XML file. As for As I know, Android itself take care of that button or text view appearance proportionate or same among ldpi, mdpi or hdpi devices as I defined dimension in dip. This is one of the recommendations, if you want to provide multi screen support. My Question is does dip is only useful in handling ldpi,mdpi or hdpi devices with same width and height means all 320X480 or all 400X840 like that or is it also support across multi screen dimensions means If I define a button with 100X30 dip for 320X480 device, after adding all screen support true in manifest file, android system it self will recalculate the widget size to some 200X60 dip to 700X1024 device.
If dip does n't work across multiple screen sizes(if device physical sizes are different) then I need to write sepearte layout file for each devices where I can't define my complex layouts with Linear Layouts with some weights, correct me if I wrong. Are there any alternatives, suggest me. Thanks In Advance.
dip
is "density-independent", so these measure units are tied to density and not the screen size. For example, there are 10" tablets that are stillmdpi
, and of course layouts that look well on smallmdpi
phones will look terrible on those devices. The workaround here is to use dimension values and override them for such cases. Now, instead of using, for example,10dip
inside your XML, you will be using@dimen/dip_10
, which will have different values invalues/mdpi
andvalues/xlarge-mdpi
. Hope this helps.