my current android project requires the width of button should be set dynamically depending on the resolution available on device
i want to arrange 9 button in a row but the size will depend on the resolution available
for the current scene we are using below code
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
//int sheight = displaymetrics.heightPixels;
int swidth = displaymetrics.widthPixels;
int px=swidth/11;
bW.setWidth(px);
bE.setWidth(px);
bR.setWidth(px);
bT.setWidth(px);
bY.setWidth(px);
bU.setWidth(px);
bI.setWidth(px);
bO.setWidth(px);
bP.setWidth(px);
somehow the width of button is not changed in any manner it remains the same