Android ScrollView's scroll disable when set width & height programically -
i had following structure in android application
linearlayout scrollview linearlayout -- elements ---
then need set width & height of scrollview programically. wrote following code
scrollview sv=(scrollview)activity.findviewbyid(r.id.menuscroll); linearlayout.layoutparams relp=new linearlayout.layoutparams(width/2,height-margin); relp.setmargins(width, 0, 0, 0); sv.setlayoutparams(relp);
but when added setlayoutparams
, scroll property. can't scrolling internal elements. idea ? new android.
thanks
i use relativelayout:
private scrollview mscrollview; mscrollview = (scrollview) findviewbyid(r.id.scrollview); relativelayout.layoutparams layoutparams = (relativelayout.layoutparams) mscrollview.getlayoutparams(); layoutparams.leftmargin= width; layoutparams.setmargins(width, 0, 0, 0); mscrollview.setlayoutparams(layoutparams);
this works me. think that's similar linearlayout.
Comments
Post a Comment