Skip to content Skip to sidebar Skip to footer

How To Put Up Or Down A View Programatically?

I have a xml that the basic 'skeleton' is

Solution 1:

Since you are placing both widgets inside a FrameLayout you can change its gravity like below:

FrameLayout.LayoutParamsdrawViewLayoutParams= drawView.getLayoutParams();
drawViewLayoutParams.gravity = Gravity.BOTTOM;

FrameLayout.LayoutParamseditTextLayoutParams= editText.getLayoutParams();
editTextLayoutParams.gravity = Gravity.TOP;

Solution 2:

The only way to do this is to remove all of the FrameLayout's children and put them back in the order you need.

Or you can use another RelativeLayout and change the LayoutParams for the two Views

Post a Comment for "How To Put Up Or Down A View Programatically?"