What if I use a String Builder to create just a giant TextView with
all of the comments spanning across a ScrollView? Will this still be a
bad idea and take up more memory? Because I really don't want to have
to revert to using the ListView.

On Apr 17, 5:13 pm, Matthew Patience <matthewj.patie...@gmail.com>
wrote:
> Great, thanks a lot.
>
> I'll take a look at those places.
>
> On Apr 17, 4:05 pm, patbenatar <patbena...@gmail.com> wrote:
>
>
>
> >Matthew-
>
> > For learning to custom style your ListView, look into Android UI
> > Styles & Themes [there's a good article over at developer.android.com
> > on this topic]. In a way they're like CSS, allowing you to apply
> > certain style traits to certain elements..
>
> > A great resource for learning UI is the open-source stock Android apps
> > [Browser, Email, SMS, Clock, etc]... You can find and download these
> > source packages by searching Google for "android source".
>
> > Definitely stick with the ListView as it is designed to recycle Views,
> > keeping in memory only enough Views needed to fill the user's screen.
> > You can learn to style the ListView in any way you like.
>
> > -Nick
>
> > On Apr 17, 12:14 pm,MatthewPatience<matthewj.patie...@gmail.com>
> > wrote:
>
> > > In that case, I shall stick with the ListView for now. I was just
> > > trying to make it look better as I still have trouble trying to
> > > implement Fancy ListViews.
>
> > > On Apr 17, 2:50 pm, Mark Murphy <mmur...@commonsware.com> wrote:
>
> > > >MatthewPatiencewrote:
> > > > > I need some help with the following scenario, as I am so used to make
> > > > > all of my layouts with XML, but now I have a situation where that
> > > > > won't work.
>
> > > > > I am working on the second version of my app that delivers news, in
> > > > > the comments section I used to use a listview to display user
> > > > > comments, but it doesn't work that great for comments that could be
> > > > > anywhere from 5  to 500+ characters long.
>
> > > > Why do you feel it doesn't work?
>
> > > > > So I want to create a whole
> > > > > bunch of TextViews in a scrollview and stack them below each other.
>
> > > > Ummmm...you're going to need something between those layers. Probably a
> > > > ScrollView holds a LinearLayout which holds TextViews.
>
> > > > > My best guess was this, although it is definitely wrong because it
> > > > > only shows one comment. I assume I have to use some kind of
> > > > > LayoutParams and so I've looked into it but am still not sure how
> > > > > exactly to use them. Can anyone suggest a way to do what I want?
> > > > > ____________________________________
> > > > > for (String comment : comments_list) {
>
> > > > >                    TextView txt_comment = new TextView(this);
> > > > >                    txt_comment.setText(comment.toString());
> > > > >                    txt_comment.setTextColor(R.color.solid_black);
>
> > > > >                    comment_layout.addView(txt_comment);
> > > > > }
>
> > > > Yes, you need LayoutParams. More importantly, you need a LinearLayout or
> > > > something -- a ScrollView only has one child. So, add your TextViews to
> > > > the LinearLayout via addView() with a LinearLayout.LayoutParams object.
>
> > > > However, if you are going to have more than a few dozen comments, you
> > > > really really really want to roll back to the ListView approach, as your
> > > > proposed UI will take up a fair bit of memory and a fair bit of CPU time
> > > > to create. The advantage of ListView is that it can show thousands of
> > > > comments using only a handful of TextViews -- your approach would
> > > > require thousands of TextViews.
>
> > > > --
> > > > Mark Murphy (a Commons 
> > > > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > > > Warescription: Three Android Books, Plus Updates, One Low Price!
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscr...@googlegroups.com
> > > > For more options, visit this group 
> > > > athttp://groups.google.com/group/android-developers?hl=en
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/android-developers?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to