Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
365 views
in Technique[技术] by (71.8m points)

android - ListView vs LinearLayout

I'm writing a horizontal tv-view, similar to the ones you know form tivo systems and similar. For each channel there is a row with the programmes for the next 6 hours or so, with a width proportional with their play time.

My idea is to write a custom widget for each row, and stack these on top of each other. This should allow me to load the data incrementally, rather than using one big custom view. I will however still need forward/backward buttons at the top of the page that update all rows when clicked.

Now I'm unsure whether I should place these Views in a ListView or a LinearLayout.

I have collected the following pros and cons:

  • ListView
    • Pros
      • Memory efficient - Recycles hidden Views
      • Seems to be used by everyone, in the Android community, for anything.
      • It might be easier to make it lazy, when updating the rows, and thus require less CPU.
    • Cons
      • Overkill - I won't be using most of the features it has to offer
      • It may be slightly more difficult to attach the clickListeners.
  • LinearLayout
    • Pros
      • Simple to use. Does what you'd expect.
    • Cons
      • I haven't seen it used anywhere for long lists.
      • Perhaps it is slower?

The "Seems to be used by everyone" argument for ListView also includes the "Master" Twitter app, which Google uses to show off "Good Android design". They also don't seem to be using most of its features.

Do you have any experience with this kind of work? Are there any recommendations I've missed when reading through the docs?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

That schedule looks similar to the Google IO 2010 app. You can checkout their code and see how they have done it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...