0

I want set 55000 height to ListView

This process long a time ( about 5-6 seconds )

I use below code but not working in Thread

new Thread(new Runnable() {

      @Override
      public void run() {
            params.height = 55000;
            lstContent.setLayoutParams(params);
            lstContent.requestLayout();
            lstContent.post(new Runnable() {

                      @Override
                      public void run() {
                                lstContent.setVisibility(View.VISIBLE);
                      }
                });

            }
  }).start();

If i use setLayoutParams in Runnable , application not work for 5-6 seconds until load complete

My Name
  • 285
  • 1
  • 4
  • 18
  • i think the ui should be modified only on the `main/ui` thread. [link](http://developer.android.com/training/multiple-threads/communicate-ui.html) – amelogenin Apr 11 '16 at 19:38
  • Can you help me more ? – My Name Apr 11 '16 at 19:42
  • You could try the following links: [link1](http://stackoverflow.com/questions/4369537/update-ui-from-thread) and [link2](http://www.intertech.com/Blog/android-non-ui-to-ui-thread-communications-part-1-of-5/) – amelogenin Apr 11 '16 at 19:54
  • Thank your, but this article not work for me – My Name Apr 11 '16 at 20:07

1 Answers1

1

There is absolutely no reason to make a list view with the height of 55000. List view should be MATCH_PARENT at most. The whole purpose of list view is reusing views, that way the list view appear to be long, while it takes only the height of the screen.

Uriel Frankel
  • 14,304
  • 8
  • 47
  • 69