android - what is the difference between layout_weight and using dp? -
i want create scalable view.
should prefer using linear layout property: layout_weight
or using layout_width: x dp ? (which relative , not apolute pixels)
what difference?
this highly depends on exact use case.
layout_weight
depends on number , size of other views in same viewgroup.
dp (density-independant pixels)
depends on density of device.
usually, dp used have view displayed @ same physical size on devices different screen densities, while weight makes sure view fills percentage of parent viewgroup.
Comments
Post a Comment