You are saying use a <fragment> tag inside of the item layout of a
ListView?  No this will not work.  This is going down the path of really
abusing ListView.  The design of ListView is about efficiently scrolling
through a large number of items, being able to cycle through them at a
60fps frame rate.  You already need to be careful about these items to keep
performance up -- keeping their hierarchy small, efficiently recycling
them, etc.  Thinking about throwing a fragment into one of them goes
against a lot of what ListView is about.

On Mon, May 14, 2012 at 6:15 AM, spotleo <l...@spotleo.com> wrote:

> Dianne or Romain Guy?
> Or anyone else can provide any suggestions?
>
>
> On Thursday, April 26, 2012 1:45:34 PM UTC+8, spotleo wrote:
>>
>> Hi,
>>
>>     I have a reusable UI component Fragment A that has been used
>> throughout various Activities and they all worked fine.
>> The controller logic is placed inside Fragment A whereas the view
>> layer is defined in Fragment A's layout file.
>>
>> Now I have a requirement to add Fragment A into part of Listview
>> item's layout file.
>> From my understanding, Fragment is no different from View from view
>> tree's perspective. In other words
>> when we use Hierarchy Viewer to inspect the view tree, we won't see
>> Fragment A, but instead we'll see the view
>> returned from Fragment A's onCreateView, so theoretically it is ok to
>> place Fragment A inside Listview item and I have
>> successfully done so.
>>
>> My question is, is my assumption correct? Is it safe to place Fragment
>> into ListView item?
>> Anything I need to be aware of when doing this?
>>
>> thanks
>
>  --
> 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
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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