【发布时间】:2018-07-20 15:40:45
【问题描述】:
我在相对布局中有一个 recyclerview,应用程序运行良好,导航抽屉很流畅。但是我在回收站视图上添加了一个 Imageview,以便我可以根据数据的可用性隐藏和显示。但是一旦我添加了 Imageview,导航抽屉就会变得非常慢。当我删除 Imageview 时,它再次运行顺利。图像大小仅为 38kb。有人可以告诉我如何以有效的方式显示空状态
这是我的 ImageView 布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.test.sample.itemHistory"
tools:showIn="@layout/app_bar_item_history"
android:background="#ffffff">
<android.support.v7.widget.RecyclerView
android:id="@+id/materialList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/imageViewNoItems"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/noItems" />
</RelativeLayout>
提前致谢
【问题讨论】:
标签: android user-interface layout imageview android-recyclerview