Defina parâmetros de layout no valor do 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