@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final TypedArray styledAttributes = getActivity() .getTheme() .obtainStyledAttributes( new int[] {R.attr.colorPrimary, R.attr.inverse_action_bar_color}); swipeToRefresh.setColorSchemeColors( styledAttributes.getColor(1, 0), styledAttributes.getColor(1, 0)); swipeToRefresh.setProgressBackgroundColorSchemeColor(styledAttributes.getColor(0, 0)); styledAttributes.recycle(); swipeToRefresh.setOnRefreshListener(this); }