My Name
My Name

Reputation: 285

Android: setLayoutParams after load completed

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

Upvotes: 0

Views: 134

Answers (1)

Uriel Frankel
Uriel Frankel

Reputation: 14622

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.

Upvotes: 1

Related Questions