Reputation: 843
Is using dp alone good enough to ensure that the size of the UI elements will be consistent aross all screen sizes and densities? Or do we have to use Linear Layout's weightSum feature to ensure a more consistent result?
Upvotes: 2
Views: 177
Reputation: 2260
Yes it is. If you want to have same look and feel on different screen resolutions . it is a relative measure hence it calculates how much pixels to take on different screens whereas pixels are absolute. For consistent Ui and user experience its recommended.
Upvotes: 2
Reputation: 34522
Yes.
Depending on what you try to accomplish: dp will ensure the same size across screens, and weights (or percent in the android support library) will keep its ratios.
Upvotes: 3