0

I have a relative layout that will expand / collapse - so I increase/decrease the height when a user taps on it.

I'm using this code

RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) view.getLayoutParams();
params.height = intialExpandedHeight; // or initialHeight - based on the expand or collapse effect
params.width = screenWidht + 150; // or a screenWidht value when collapsed
view.setLayoutParams(params);
view.requestLayout();

The height of the layout changes and it works the way I want it to - the only problem is that the width is not changing. (it's the same every time)

Could you please tell me what seems to be the problem with my code? Why does the height changes but not width?

Alin
  • 1,044
  • 6
  • 20
  • 42

0 Answers0