java Android SwipeRefreshLayout刷新指示器不可见
我用的是安卓系统。支持v4。小装置。在一个片段内部创建一个布局。刷卡可以很好地刷新我的数据,但我只能看到一个空白的白色圆圈作为刷卡指示器。关于这一点,我看到的所有其他问题似乎都不起作用
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_all_assets,container,false);
mListView = (ListView) view.findViewById(R.id.listView);
mSwipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container);
mSwipeLayout.setColorSchemeColors(安卓.R.color.holo_blue_bright,
安卓.R.color.holo_green_light,
安卓.R.color.holo_orange_light,
安卓.R.color.holo_red_light);
return view;
}
XML
<?xml version="1.0" encoding="utf-8"?>
<安卓.support.v4.widget.SwipeRefreshLayout
安卓:id="@+id/swipe_container"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
xmlns:安卓="http://schemas.安卓.com/apk/res/安卓">
<ListView
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:id="@+id/listView"
安卓:layout_alignParentTop="true"
安卓:layout_centerHorizontal="true"/>
</安卓.support.v4.widget.SwipeRefreshLayout>
依赖关系
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.安卓.support:support-v13:21.0.0'
compile 'com.安卓.support:appcompat-v7:21.0.+'
compile 'com.google.zxing:安卓-integration:3.1.0'
如何使此刷新指示器工作
# 1 楼答案
问题是
setColorSchemeColors()
期望颜色整数作为输入(例如Color.BLUE
),而不是颜色资源ID您应该改用^{} ,它接受颜色资源引用