herbertD
herbertD

Reputation: 10965

Android, how to disable the showing "loading..." when loading a gridview?

When my gridview loading content, it will always show a "loading..." string in grid item.

How can I disable it? so I want to keep the grid as original style when loading something.

Thanks!

Upvotes: 0

Views: 144

Answers (1)

st0le
st0le

Reputation: 33545

Here's what I do.

Have a Frame Layout or a Relative Layout containing both the GridView and a TextView (fill_parent with text "Loading..." in the center).

During your AsyncTask, onPreExcute set the visibility of the gridView to View.GONE and the textview to Visible, and during onPostExecute, switch back the visibility of GridView to Visible and turn off the visibility of the textview.

Instead of a TextView it can also be a composite layout containing a Progress Bar and a text view.

This is also how "Empty View" works. (atleast for old versions)

Upvotes: 1

Related Questions