1

Usually sp is used for setting text size but is it a bad practice to use that for setting dimensions of view in layout? I did not see any warning on this line of .xml file:

android:layout_height="20sp"

This question indirectly follows my previous question.

hasanghaforian
  • 13,858
  • 11
  • 76
  • 167

1 Answers1

1

Using sp for View dimensions will literally scale the entire UI based on the user's font size preference. If that's what you want, go for it. But I would imagine you'll run into difficulties making your Views look good at all font size preference levels. You'll design your UI for one font size and then when you switch to another your Views will look dramatically different.

Gavin Wright
  • 3,124
  • 3
  • 14
  • 35