Saturday, November 8, 2008

List with custom or no separator

My achievement today ( OK, it's just a small one )

I wanted to have no separator in my list activity...

After some moment parsing all the documentation in every possible way, here what I found :

public class ScorePage extends ListActivity
{

Score mScore;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle)
{
super.onCreate(icicle);

this.getListView().setDivider( null );
this.getListView().setDividerHeight(0);
}


By the way, is the DividerHeight set necessary ?
I added it because of a very stressful comment on the SetDivider method...

(One test later )

It is by no way necessary !!
But I find that adding a non zero height was what I was wanting for, ie adding a blank space between two entries !


Next step tomorrow !

3 comments:

Localtone, LLC said...

Thanks for this tip! I had been having a tough time finding this in the documentation myself. Came across your blog and it makes sense now.

AndroidBlogger said...

Thank you for your comment !
It's always nice to know that this blog is useful !

Anonymous said...

good tip.
But on xml, there are no way, isn't it?