2

I tried to change RelativeLayout's height programmatically, that is using Java. I have the following code:

RelativeLayout rl = (RelativeLayout) findViewById(R.id.center);
rl.getLayoutParams().height = 100;

I'm bothered of the unit of height.

Is it px, dp or some other unit?

If it is px, is there a way I can use dp since dp is more advisable than px because it's actually dynamic?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
princepiero
  • 1,287
  • 3
  • 15
  • 28
  • Convert dps to pixels [you can find answer here][1] [1]: http://stackoverflow.com/questions/5255184/android-and-setting-width-and-height-programmatically-in-dp-units/5255256#5255256 – shyam.y Jan 27 '14 at 07:52

0 Answers0