On 1/22/2016 9:59 AM, TreKing wrote:
On Thu, Jan 21, 2016 at 11:25 PM, P Hill <[email protected]
<mailto:[email protected]>> wrote:
Why do I get two rows of "Medium Size Text? Large Text?"
Define "two rows of ...". Maybe post a screenshot. Are you
manipulating views at runtime in any way?
I found that I was manipulating the fragment at runtime and in the XML
definitions!
I was trying to combine a master-detail sample (with the possibility of
two different layouts thus the "body" was a fragment) and a ListView
sample which I had been adding to, both originally generated from a
Gallery example.
The Activity XML DEFINITION did an include the Fragment with the nested
ListViews, then the Activity CODE made the fragment and added it again.
But because of a rewriting error in the code (1) a second instance of
the Fragment was added to the 1st instance of the Fragment and not the
outer group of the Activity.
When the code added the 2nd instance of the fragment again, the 1st
Fragment was made of Two TextAreas and an empty list (I think),
"Medium Size Text? Large Text?"
(empty list)
adding the second time put the fragment just below all that and started
again with my horizontally listed text fields and then the rest of the
fragment which was a simple vertical list filled via code with values
resulting in
"Medium Size Text? Large Text?" <-- 1st instance of Fragment (followed
by an empty list?)
"Medium Size Text? Large Text?" <-- 2nd instance of Fragment added at
the bottom of the 1st instance.
list item 1 - <-- dynamically filled list row 0 in Fragment2
list item 2 <-- dynamically filled list row 1 in Fragment2
(1) the error I introduced while rewriting was I did a add(fragmentId,
fragment) instead of add(parentActivity, fragment).
What I don't know if I should be adding the fragment directly to the
parent activity or is better to have some additional group that only
contains the fragment. How to best handle layout styling without being
overly complex is still not something I completely understand.
Of course there was bits of space between the various items which I
didn't bother to work out exactly how much and from where it came.
Thanks for the ideas to help track down the doubling I was seeing.
-Paul
--
You received this message because you are subscribed to the Google Groups "Android
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/56A6C313.7070003%40gmail.com.
For more options, visit https://groups.google.com/d/optout.