我在viewpager中解析一个json数组,我目前让viewpager加载一个片段" panel"进入Recyclerview。但是,如果jsonarray没有加载我想要如下所示的fragment_dashboard来显示图像我该怎么做呢?
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivitys.Dashboard">
<!-- TODO: Update blank fragment layout -->
<android.support.v7.widget.RecyclerView
android:id="@+id/fragment_dashboard_recycler"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
答案 0 :(得分:2)
您是否尝试过设置此类背景
android:background="@drawable/background"
然后您可以通过编程方式隐藏它
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.fragment_dashboard_recycler);
recyclerView.setBackgroundResource(null); //or some blank background from drawable