android - Setting width of a view as a fraction of the width of screen -
can set width of view
fraction of screen's width? if yes, how?
here's code
var screenwidth = (int)(resources.displaymetrics.widthpixels / resources.displaymetrics.density); double prc = 0.35; double w = prc * screenwidth; // 35 percent of screen linearlayout.layoutparams viewparams = new linearlayout.layoutparams(convert.toint32(w), viewgroup.layoutparams.matchparent); layout.layoutparameters = viewparams;
Comments
Post a Comment