private void obtainMargin ( @ StyleRes final int themeResourceId ) { TypedArray typedArray = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( themeResourceId , new int [ ] { R . attr . materialDialogMarginLeft , R . attr . materialDialogMarginTop , R . attr . materialDialogMarginRight , R . attr . materialDialogMarginBottom } ) ; int defaultHorizontalMargin = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_horizontal_margin ) ; int defaultVerticalMargin = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . dialog_vertical_margin ) ; int left = typedArray . getDimensionPixelSize ( 0 , defaultHorizontalMargin ) ; int top = typedArray . getDimensionPixelSize ( 1 , defaultVerticalMargin ) ; int right = typedArray . getDimensionPixelSize ( 2 , defaultHorizontalMargin ) ; int bottom = typedArray . getDimensionPixelSize ( 3 , defaultVerticalMargin ) ; setMargin ( left , top , right , bottom ) ; }
Obtains the margin from a specific theme .