code: public void setMargin(@Nullable String marginString) {
          if (!TextUtils.isEmpty(marginString)) {
              // remove leading and ending '[' ']'
              try {
                  marginString = marginString.trim().substring(1, marginString.length() - 1);
                  String marginStringArray[] = marginString.split(",");
                  int size = marginStringArray.length > 4 ? 4 : marginStringArray.length;
                  for (int i = 0; i < size; i++) {
                      String marginStr = marginStringArray[i];
                      if (!TextUtils.isEmpty(marginStr)) {
                          margin[i] = parseSize(marginStr.trim().replace("\"", ""), 0);
                      } else {
                          margin[i] = 0;
                      }
                  }
                  Arrays.fill(margin, size, margin.length, margin[size - 1]);
              } catch (Exception e) {
                  Arrays.fill(margin, 0);
              }
          }
      }
docs: Parse margin with string like '[10,10,10,10]'
  @param marginString