Установить параметры макета в значении DP
float factor = getResources().getDisplayMetrics().density;
int pxWidth = (int)(dpWidth * factor);
int pxHeight = (int)(dpHeight * factor);
LinearLayout.LayoutParams layoutParams =
new LinearLayout.LayoutParams(pxWidth, pxHeight);
Yonathan Shterenberg