Well, adding paddingTop on the listView is not what I want. I would
like margin only on the first item in the list and list to use whole
area when scrolled. From design point of view, there is valid reason
(I think so) why I want to do this. On the other hand, it shouldn't be
that hard to set that top margin.

I can't use header view because app crashes when I filter the adapter
and when adapter.notifyDataSetChanged() is issued.

On Dec 14, 12:10 pm, Kostya Vasilyev <[email protected]> wrote:
> You can specify android:paddingTop on the ListView.
>
> This might not do the right thing if you have a header view. In that
> case, set android:paddingBottom on the header view.
>
> -- Kostya
>
> 14.12.2010 20:27, bobetko пишет:
>
>
>
>
>
>
>
>
>
> > I would like to add Top Margin on the first item in the ListView. Is
> > that possible? Or, how can I reference first list item in the List
> > View?
>
> > I tried
>
> > lv = (ListView)getListView();
> > View myRowItem = lv.getChildAt(0);
>
> > This probably doesn't work because at the moment I executed it, list
> > items didn't exist yet. I assume I should try above code in something
> > like onPostRender event. Is there something like that in Java Android?
>
> > I was also trying to play with LayoutParameters in my adapter's
> > GetView method. This seemed the solution at first, but I couldn't find
> > a way to change topMargin of item at position 0. My app would crash
> > every time.
>
> > Also tried to add header view. Which is fine until you start changing
> > your adapter. I made couple posts here (http://groups.google.com/group/
> > android-developers/browse_thread/thread/e4f45402a1b584c7/
> > d065364fa368a23f?show_docid=d065364fa368a23f) about that issue, but on
> > the end, I concluded that it is not right way to go.
>
> > And, the reason I am trying to do this, it's pure design issue. I want
> > list when scrolled to use the whole working area, but when shown first
> > time, I would like to have some space between top edge and first item.
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget 
> --http://kmansoft.wordpress.com

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

Reply via email to