我是Android的新編程,我在ADT中有一個非常簡單的例子,我每幀只有2個ImageView在一個FrameLayout中,但是當我用我的手機測試它的應用程序真的很慢,因爲它沒有任何邏輯原因,我沒有碰到java文件夾。Android - 該應用程序可能在其主線程上做了太多的工作
這是我在
12-16 16:17:43.261 18238-18238/com.example.brank.acocinapp I/Choreographer: Skipped 64 frames! The application may be doing too much work on its main thread.
12-16 16:17:44.781 18238-18248/com.example.brank.acocinapp W/art: Suspending all threads took: 26.044ms
12-16 16:17:44.831 18238-18238/com.example.brank.acocinapp W/PathParser: Points are too far apart 4.000000596046461
得到錯誤這是我content_main.xml
<?xml version="1.0" encoding="utf-8"?>
<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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.brank.acocinapp.MainActivity">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/frameLayout2"
android:layout_alignParentBottom="true">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/imageView3"
android:adjustViewBounds="true"
android:src="@drawable/home2" />
</FrameLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/frameLayout"
android:layout_alignParentTop="true">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/imageView2"
android:src="@drawable/home1"
android:adjustViewBounds="true"/>
</FrameLayout>
</RelativeLayout>
的XML我不得不提,如果我評論兩者之一的FrameLayout問題犯規存在。提前致謝。
編輯:我也把2個圖像中的文件夾可繪製(我不知道這是否會影響),但我在一個教程,我已經把在子文件夾中的圖像繪製對象看到(MDPI,華電國際,xhdpi ,xxhdpi)的事情是,這個子文件夾不存在,所以我粘貼我的圖像繪製。
它有可能是你的圖像非常大?你可以創建一個文件夾** drawable-nodpi **來放置你的圖像。 –
使用AsyncTasks和線程將有所幫助。如果所需的可繪製文件夾不存在,只需製作它們即可。 –
@JoseAngelManeiro我的圖像是1024x768 PNG,大小是1.40M,你認爲它是一個應用程序的大圖像?建議的分辨率和尺寸應該是多少? –