Android : android RelativeLayout change height programmatically

on Friday, September 26, 2014


i try change layout height programmatically.i have to buttons.in one button click i change my layout position and second button click i try to recive save position witch i was first time



<RelativeLayout
android:id="@+id/popaplayout"
android:layout_width="fill_parent"
android:layout_height="200dp" >


this is a my layout and in first button click i wrote



RelativeLayout.LayoutParams parms = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.FILL_PARENT,
RelativeLayout.LayoutParams.FILL_PARENT);
parms.addRule(RelativeLayout.BELOW, R.id.movies_title_layout);
scrollpopap.setLayoutParams(parms);

scrollpopap.setScrollingEnabled(true);


and second click



RelativeLayout.LayoutParams rel_btn = new RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, 300);
rel_btn.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
scrollpopap.setLayoutParams(rel_btn);
scrollpopap.setScrollingEnabled(false);


in xml file i wrote height 200dp and programmatically 300 and there are different height.how i can wrote save height in programmatically?


if anyone knows solution please help me thanks


0 comments:

Post a Comment