|ListView: invisible dividers still take up space. Is it a bug or a feature?||brian.s...@googlemail.com||7/30/09 4:30 AM|
I'm using a ListView with a custom ListAdapter and a custom Drawable
My list contains active elements and passive ones as well. By default,
the ListView draws a divider only between two active items. This is
exactly what I want it to do, expect that ListView leaves
"dividerHeight" pixles free space above and under eacht inactive item.
Because my ListView has no background-graphic (which is on purpose and
can't be changed) I see slices of the underlying Views through my
If you have any dificulties imagining what this means, have a look at
I'm rather sure this is a Bug, but maybe it's the intended behaviour.
I wanted to hear your opinion (as well as a workaround, if there is
any) before filing a bug at b.android.com I can even imagine a reason
for the behaviour as it is: If you wanted to make list items active/
inactive at runtime, the current implementation does not change the
positioning of the items, while the behaviour I proposes would do. But
I'm not sure if activatin/inactivating items is a real need.
I'm thinking about not using the build in divider feature at all and
inserting a special "divider item" between each two active items
manually. I think this will fix it, too, but I'd rather like another
|Re: ListView: invisible dividers still take up space. Is it a bug or a feature?||Yusuf Saib (T-Mobile USA)||7/30/09 8:45 AM|
I can't speak for the original designers' and coders' intent, but it
may be they intended to put a space there so that when an item is
selected, they can put a yellow rectangle around it, which, they do.
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.
On Jul 30, 4:30 am, "brian.schim...@googlemail.com"
<brian.schim...@googlemail.com> wrote:> If you have any dificulties imagining what this means, have a look athttp://brianschimmel.de/divider.jpg
|Re: [android-developers] ListView: invisible dividers still take up space. Is it a bug or a feature?||Romain Guy||7/30/09 8:57 AM|
> I'm rather sure this is a Bug, but maybe it's the intended behaviour.
This is not a bug. Just set the dividerHeight to 0.
Note: please don't send private questions to me, as I don't have time
|Re: ListView: invisible dividers still take up space. Is it a bug or a feature?||brian.s...@googlemail.com||7/30/09 9:32 AM|
I think you just got me wrong. If I wanted to have no dividers at all,
I would set dividerHeight to 0, of course.
Indeed, I want to have dividers between enabled items, but no dividers
next to disabled ones. The code in ListView.dispatchDraw() already has
code for this:
if (bottom < listBottom &&
(adapter.isEnabled(first + i) && (i ==
count - 1 ||
adapter.isEnabled(first + i +
bounds.top = bottom;
bounds.bottom = bottom + dividerHeight;
drawDivider(canvas, bounds, i);
but the code related to the layout of the children seems to ignore the
presence of disabled items. It's reserving space for dividers that
will not be drawn by dispatchDraw.
Maybe this is intended as well. But anyway, I wish it was intended
(and implemented) the other way ;)
I think I can't help that with dividerHeight, because it is a global
property that affects all dividers at once.
with best regards,
|Re: [android-developers] Re: ListView: invisible dividers still take up space. Is it a bug or a feature?||Romain Guy||7/30/09 11:02 AM|
> but the code related to the layout of the children seems to ignore the
This is the intended behavior.