3

當我在我的模擬器上測試我的應用程序(具有水平滾動視圖)時,滾動部分在中間凍結。有時,當我以另一種方式滾動時滾動會凍結。應用程序不會因爲後退按鈕的作用而凍結。這會凍結在實際的Android設備上,還是這只是我的模擬器反應?Android Studio:水平滾動視圖在模擬器上測試時凍結

這裏是我的滾動活動代碼:

<RelativeLayout 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" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
android:paddingBottom="@dimen/activity_vertical_margin" 
tools:context="namee.com.myapp.School" 
android:background="#000000"> 

<HorizontalScrollView android:id="@+id/horizontalScroll" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:fadingEdgeLength="20dp" 
    android:background="#000000"> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="#000000"> 

     <ImageView android:src="@drawable/sunset3" android:layout_height="354dp" android:layout_width="600dp" /> 
     <ImageView android:src="@drawable/sunset3" android:layout_height="354dp" android:layout_width="600dp" /> 
     <ImageView android:src="@drawable/sunset3" android:layout_height="354dp" android:layout_width="600dp" /> 


     </LinearLayout> 

</HorizontalScrollView> 

這裏是sunset3

http://postimg.org/image/5l69hadel/

+0

只是佈局沒有人可以告訴問題在哪裏。發佈Java代碼或堆棧跟蹤(如果有的話)。 – Gumbo 2014-08-29 21:33:46

+0

@Gumbo沒有.java,它只是在活動中。 – MGames 2014-08-29 21:35:28

+0

@Gumbo它真的類似於這個:https://www.youtube.com/watch?v = 0PAsR5sIi6E – MGames 2014-08-29 21:36:17

回答

0

我嘗試了我的Android設備(三星Galaxy S4迷你,Android 4.4系統上。 2),它工作正常。這可能是仿真器的一些問題(例如內存限制太低)。

+0

我應該設置什麼內存限制? – MGames 2014-08-29 23:12:42

+0

@ user3859020儘可能多的。圖像相當大。如果模擬器耗盡內存,這實際上會在logcat中產生一個錯誤,但您可以嘗試。 – Gumbo 2014-08-29 23:27:32

+0

這不會影響某些手機的兼容性嗎? – MGames 2014-08-29 23:33:46

3

對我來說,關閉「使用主機GPU」功能可以在模擬器中滾動時解決凍結問題。

1

在我的情況 - 垂直滾動條 - 這是一個API編號的問題。 使用主機GPU,RAM 512和VM堆32(同時嘗試256)在2個AVD上運行的相同程序。

API 21工作,API 19凍結。增加VM堆並沒有解決問題,但我確認禁用主機GPU工作(顯然所有的都變得非常慢)。