开发者

Create an android ListView with margins that aren't applied to the header

开发者 https://www.devze.com 2023-03-22 22:15 出处:网络
I currently have a ListView in Android with a LinearLayout as a header. I would like to have a left and right margin apply to the items in the ListView, but not to the header. Is there any easy way to

I currently have a ListView in Android with a LinearLayout as a header. I would like to have a left and right margin apply to the items in the ListView, but not to the header. Is there any easy way to do this? One approach I attempted was wrapping the list items in LinearLayout, but that caused a class cast exception at开发者_开发问答 runtime.


You can set the padding attribute on your ListView without affecting the parent layout. You also should be able to embed a linear layout within your parent layout but thats a seperate issue


Try adding left/right padding to the row view layout.

0

精彩评论

暂无评论...
验证码 换一张
取 消