可以更改SwipeRefreshLayout中使用的drawable吗?

时间:2014-11-27 18:22:05

标签: android drawable geometry android-progressbar swiperefreshlayout

是否可以将SwipeRefreshLayout中的可绘制默认进度更改为自定义drawable?

如果是,我会丢失旋转/动画或其他财产吗?

The said drawable

1 个答案:

答案 0 :(得分:1)

mSwipeRefreshLayout = (SwipeRefreshLayout)findViewById(R.id.your_swiperefresh_id);
try {
    Field f = mSwipeRefreshLayout.getClass().getDeclaredField("mCircleView");
    f.setAccessible(true);
    ImageView img = (ImageView)f.get(mSwipeRefreshLayout);
    img.setImageResource(R.drawable.your_drawable_file);
} catch (NoSuchFieldException e) {
    e.printStackTrace();
} catch (IllegalAccessException e) {
    e.printStackTrace();
}