Establezca parámetros de diseño en el valor 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