float convertDimenToPixel(string dimen) { if (dimen.EndsWith("dp")) { return(DynamicHelper.dpToPx(Float.ParseFloat(dimen.Substring(0, dimen.Length - 2)))); } else if (dimen.EndsWith("sp")) { return(DynamicHelper.spToPx(Float.ParseFloat(dimen.Substring(0, dimen.Length - 2)))); } else if (dimen.EndsWith("px")) { return(Integer.ParseInt(dimen.Substring(0, dimen.Length - 2))); } else if (dimen.EndsWith("%")) { return((int)(Float.ParseFloat(dimen.Substring(0, dimen.Length - 1)) / 100f * DynamicHelper.deviceWidth())); } else if (dimen.Equals("match_parent")) //equalsIgnoreCase("match_parent")) { return(ViewGroup.LayoutParams.MatchParent); //.MATCH_PARENT; } else if (dimen.Equals("wrap_content")) //.EqualsIgnoreCase("wrap_content")) { return(ViewGroup.LayoutParams.WrapContent); } else { return(Integer.ParseInt(dimen)); } }