Create an android ListView with margins that aren't applied to the header
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.
精彩评论