0

I have two layouts - 1 RelativeLayout and 1 CustomScrollView. The scroll view is placed below the relative layout.

I want to increase/decrease the size of the relative layout when a user taps on it and also move the scroll view accordingly.

Basically I want to have an expandable relative layout and the scroll view to remain below the relative layout at all times.

In onClick method I've tried something like this:

RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) userDescriptionContainer.getLayoutParams();
params.height = 7000;
userDescriptionContainer.setLayoutParams(params);

but it doesn't seem to have any efect.

Can anyone please tell me how can I accomplish this effect. Thanks

Alin
  • 1,044
  • 6
  • 20
  • 42

2 Answers2

-1

Try this one:

 RelativeLayout graphView=(RelativeLayout)findViewById(R.id.RR_dashview_graphView);
     LayoutParams params = graphView.getLayoutParams();
     //Changes the height and width to the specified *pixels*
       params.width  = 100; // add your width here.
           params.height = 100; // add your height here.

I hope it will help you

Thanks

  • And what is the difference between my code and yours despite the fact that you findViewById? – Alin Apr 09 '14 at 13:05
-1
RelativeLayout Rl = (RelativeLayout) findViewById(R.id.relativelayout);

RelativeLayout.LayoutParams layout_description = new RelativeLayout.LayoutParams (YourUserDefinedwidth, YourUserDefinedHeight);

Rl.setLayoutParams(layout_description);