Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:44:37+00:00 2026-06-17T06:44:37+00:00

Android 4.1.2. I have a LinearLayout with a ListView child. I add 20 rows

  • 0

Android 4.1.2. I have a LinearLayout with a ListView child. I add 20 rows to this listview, with a custom row layout with three TextView controls. Half of these rows are visible, so I need to scroll to see the rest. The problem is that the app seems to hang for a couple of seconds when I start scrolling from the top or from the bottom (in the middle it seems ok).

I understand there are several optimizations that can be used. So far, I have tried this:

  1. In my custom ArrayAdapter I’m using a ViewHolder to avoid calling findViewById.
  2. In getView(), the LayoutInflater is only used when convertView is null.
  3. getViewTypeCount() returns 1, getItemViewType(...) returns 0.
  4. Removing all calls to setText() and setColor() on my textviews.
  5. Disconnecting the debugger.

What other possible bottlenecks are there for listviews?

My row layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <TextView
        android:id="@+id/my_text1"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:textColor="@android:color/white"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/my_text2"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="4"
        android:ellipsize="end"
        android:textColor="@android:color/white" />

    <TextView
        android:id="@+id/my_text3"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:gravity="right"
        android:textColor="@android:color/white" />
</LinearLayout>

I did suspect the layout_weight attribute, but removing them did not help! In another attempt to fix this lagging problem, my ListView has these styles:

<ListView
        android:id="@+id/my_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="3dip"
        android:background="@android:color/transparent"
        android:cacheColorHint="@android:color/transparent"
        android:persistentDrawingCache="scrolling"
        android:scrollingCache="false" />

As you can see, I have tried almost everything. Still, when I scroll through these 20 rows the UI hangs for 2-4 seconds when reaching the top/bottom. Hence, scrolling back and forth makes the app freeze!

What am I missing here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:44:38+00:00Added an answer on June 17, 2026 at 6:44 am

    Another thing to consider is the possible overdraw in your list items, which can be made visible by an option in the developer settings on your device.

    For general performance issues, especially in a ListView, I can only recommend Romain Guy’s “epic” article: Android Performance Case Study. Overdraw is also referenced there as one major issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom ListView in which each row.xml looks like this: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
i have a ListView with a custom row: detail_row1.xml <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
I have a multiline TextView in Android. It is a child of a LinearLayout.
I have this layout: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=wrap_content android:orientation=horizontal android:gravity=left> <LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal>
I have this layout: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=horizontal android:layout_width=fill_parent android:layout_height=fill_parent android:background=#222222 android:gravity=center_horizontal android:layout_gravity=center_horizontal android:paddingBottom=5dp> <SeekBar
I have a layout which looks like this: <LinearLayout> <ImageView> android:width=wrap_content android:height:wrap_content ... </ImageView>
I have a linear layout with this form <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical
I have this layout: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=wrap_content android:layout_height=wrap_content > <TextView android:id=@+id/solution_title
I have three ListView widgets in the same LinearLayout . Something like this (I'm
I have a custom listView. The main layout xml is something like this: <?xml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.