code: private void obtainDialogMargin(@NonNull final TypedArray typedArray) {
          int defaultHorizontalMargin =
                  getContext().getResources().getDimensionPixelSize(R.dimen.dialog_horizontal_margin);
          int defaultVerticalMargin =
                  getContext().getResources().getDimensionPixelSize(R.dimen.dialog_vertical_margin);
          int left = typedArray.getDimensionPixelSize(R.styleable.DialogPreference_dialogMarginLeft,
                  defaultHorizontalMargin);
          int top = typedArray.getDimensionPixelSize(R.styleable.DialogPreference_dialogMarginTop,
                  defaultVerticalMargin);
          int right = typedArray.getDimensionPixelSize(R.styleable.DialogPreference_dialogMarginRight,
                  defaultHorizontalMargin);
          int bottom = typedArray
                  .getDimensionPixelSize(R.styleable.DialogPreference_dialogMarginBottom,
                          defaultVerticalMargin);
          setDialogMargin(left, top, right, bottom);
      }
docs: Obtains the margin of the preference's dialog from a specific typed array.
  
  @param typedArray
  The typed array, the margin should be obtained from, as an instance of the class
  {@link TypedArray}. The typed array may not be null