privatefloatgetSmallestWidthDp(){ DisplayMetrics dm=newDisplayMetrics();getWindowManager().getDefaultDisplay().getMetrics(dm);int heightPx= dm.heightPixels;//手机高的像素值int widthPx= dm.widthPixels;//手机宽的像素值float density= dm.density;float heightDp= heightPx/ density;//手机高的dp值float widthDp= widthPx/ density;//手机宽的dp值return widthDp