Java 为什么我添加图像时会出现延迟?
我最近在运行我的程序时遇到了延迟,我的一个活动有7个图像,我计划添加更多图像。但是,当我开始向下滚动整个事件时,我不知道是否是因为我在xml中隐藏了操作栏(我隐藏了它,因为我不知道如何将其从活动中删除),我希望你们能告诉我如何解决这个问题(滞后问题)Java 为什么我添加图像时会出现延迟?,java,android,lag,Java,Android,Lag,我最近在运行我的程序时遇到了延迟,我的一个活动有7个图像,我计划添加更多图像。但是,当我开始向下滚动整个事件时,我不知道是否是因为我在xml中隐藏了操作栏(我隐藏了它,因为我不知道如何将其从活动中删除),我希望你们能告诉我如何解决这个问题(滞后问题) 日志: 06-30 18:05:24.908:E/LocSvc_-IzatApiV02(584):W/virtual-int-izat_-core::IzatApiV02::injectLocation(GpsExtLocation):665]
日志:
06-30 18:05:24.908:E/LocSvc_-IzatApiV02(584):W/virtual-int-izat_-core::IzatApiV02::injectLocation(GpsExtLocation):665]:错误!注入位置失败
06-30 18:05:24.918:E/LocSvc_ApiV02(584):带虚拟loc_api_适配器_err LocApiV02::injectPosition(双精度,双精度,浮点):492]:错误!状态=eLOC\u客户端\u失败\u无效\u参数,注入位置\u索引状态=未知
06-30 18:05:24.968:I/GCoreUlr(6145):成功插入位置
06-30 18:05:24.968:I/GCoreUlr(6145):未呼叫LocationReportingService,hasmove:false,已用毫秒数:2176457,请求:电话
06-30 18:05:28.802:I/编舞(8748):跳过39帧!应用程序可能在其主线程上做了太多工作
06-30 18:05:29.483:I/编舞(8748):跳过了40帧!应用程序可能在其主线程上做了太多工作
06-30 18:05:30.154:I/编舞(8748):跳过39帧!应用程序可能在其主线程上做了太多工作
06-30 18:05:30.834:I/编舞(8748):跳过了40帧!应用程序可能在其主线程上做了太多工作
06-30 18:05:31.495:I/编舞(8748):跳过39帧!应用程序可能在其主线程上做了太多工作
06-30 18:05:32.166:I/编舞(8748):跳过39帧!应用程序可能在其主线程上做了太多的工作。对于滞后问题,您可以做一些事情: 你可以缩小图片的比例
当延迟出现时,您可以发布日志吗?这可能是因为您使用的图像非常繁重,需要花费时间才能加载。请发布一些代码。当出现延迟时,我已经添加了logcat,我如何修复?您的图像的分辨率是多少?300您是否建议我将其降低到多少?如果是这样,您会建议我将其降低到多少,从而使图像具有良好的质量。因此,与其将我的图像和分辨率放在另一个绘图表中,我应该将它们放在这里,抱歉,我喜欢非常具体的drawable nodpi文件夹包含所有密度的资源(与密度无关的资源)。它只减少了延迟,我将其更改为1000x1000
<ScrollView 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=".EX" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="688dp" >
<ImageView
android:id="@+id/border"
android:layout_width="wrap_content"
android:layout_height="7dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/greenborder" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/imageView2"
android:layout_marginLeft="40dp"
android:layout_marginTop="50dp"
android:clickable="true"
android:src="@drawable/ss" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/imageView1"
android:layout_marginRight="40dp"
android:clickable="true"
android:src="@drawable/cht" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_alignLeft="@+id/imageView1"
android:layout_below="@+id/imageView1"
android:layout_marginTop="28dp"
android:clickable="true"
android:src="@drawable/ags" />
<ImageView
android:id="@+id/imageView5"
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_alignLeft="@+id/imageView3"
android:layout_alignTop="@+id/imageView4"
android:clickable="true"
android:src="@drawable/as" />
<ImageView
android:id="@+id/imageView6"
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_alignLeft="@+id/imageView4"
android:layout_below="@+id/imageView4"
android:layout_marginTop="27dp"
android:clickable="true"
android:src="@drawable/ly" />
<ImageView
android:id="@+id/imageView7"
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_alignLeft="@+id/imageView5"
android:layout_alignTop="@+id/imageView6"
android:clickable="true"
android:src="@drawable/co" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageView3"
android:layout_centerHorizontal="true"
android:layout_marginBottom="9dp"
android:text="Select a category:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="@+id/imageView8"
android:layout_width="125dp"
android:layout_height="125dp"
android:layout_alignLeft="@+id/imageView6"
android:layout_below="@+id/imageView6"
android:layout_marginTop="27dp"
android:clickable="true"
android:src="@drawable/fy" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imageView8"
android:layout_alignLeft="@+id/imageView7"
android:layout_alignRight="@+id/imageView7"
android:text="More available soon"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
</ScrollView>