Advertisement

Android开发:使用_swipe_的adianshadian无法显示为空的组件

阅读量:

在应用官方提供的SwipeRefreshLayout控件时,发现原本设置的emptyView不再显示。通过查阅大量网络资源,未能找到与我所遇情况相符的解决方案,因为我的emptyView是借助一个辅助类实现的。经历多次尝试与探索后,最终成功找到了一种理想的解决方式,具体方法如下:

首先,对XML布局进行调整,在外部添加一层Framelayout,优化后的XML布局结构如下:

复制代码
 <FrameLayout

    
     android:id="@+id/parent"
    
     android:layout_width="match_parent"
    
     android:layout_height="0dp"
    
     android:layout_weight="1"
    
     >
    
  
    
     <android.support.v4.widget.SwipeRefreshLayout
    
     android:id="@+id/swipe_container"
    
     android:layout_width="match_parent"
    
     android:layout_height="match_parent">
    
  
    
     <Te

全部评论 (0)

还没有任何评论哟~