@ Nullable public static Drawable getActionBarBackground ( Context context ) { int [ ] attrs = { android . R . attr . actionBarStyle } ; TypedArray a = context . obtainStyledAttributes ( attrs ) ; int id = a . getResourceId ( 0 , 0 ) ; a . recycle ( ) ; if ( id > 0 ) { attrs [ 0 ] = android . R . attr . background ; a = context . obtainStyledAttributes ( id , attrs ) ; Drawable background = a . getDrawable ( 0 ) ; a . recycle ( ) ; return background ; } return null ; }
Get the ActionBar background in the Context s theme .