MGames
MGames

Reputation: 1181

Android Studio: Horizontal Scroll View Freezes While Testing On Emulator

When I test my application (which has the Horizontal Scroll View) on my emulator, the scrolling part freezes in the middle. Sometimes the scroll freezes when I scroll the other way.The application doesn't freeze because the back button works. Will this freeze on an actual Android device, or is this just my emulator reacting?

Here is my scroll activity code:

 <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>

Here is sunset3

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

Upvotes: 3

Views: 2375

Answers (3)

marco
marco

Reputation: 1752

In my case - vertical scrollbar - it was a matter of API number. Same program running on 2 AVDs both using host GPU, RAM 512 and VM heap 32 (tried also 256).

API 21 works, API 19 freezes. Increasing the VM heap didn't solve the problem but I confirm that disabling the host GPU works (and obviously all gets really slower).

Upvotes: 1

Hamid Fadishei
Hamid Fadishei

Reputation: 868

For me, turning off the "Use Host GPU" feature solved the freezing problem while scrolling in the emulator.

Upvotes: 3

Gumbo
Gumbo

Reputation: 1746

I tried it on my Android device (Samsung Galaxy S4 mini, Android 4.4.2), and it's working fine. It might be some problem with the emulator ( e.g. memory limit too low).

Upvotes: 0

Related Questions