final float item3widthinPixels= mActivity.getResources().getDimensionPixelSize(R.dimen.item3width);
item3.setWidth(item3widthinPixels);
final float item3widthinPixels= mActivity.getResources().getDimension(R.dimen.item3width);
item3.setWidth(item3widthinPixels);
<dimen name="item3width">100dp</dimen>