开发者

Setting background for fragment

开发者 https://www.devze.com 2023-04-06 18:11 出处:网络
开发者_运维问答I have a list fragment and a details fragment in a xml layout which is set as the layout of an activity. How can I set a background image for each fragment. If I am doing it in xml like

开发者_运维问答I have a list fragment and a details fragment in a xml layout which is set as the layout of an activity. How can I set a background image for each fragment. If I am doing it in xml like android:background=@drawable/anyimage it shows an error. I searched but didn't get what I needed, so any suggestions will be appreciated.


In my case the image file was blank and I saved it wrong. Might want to double check.

Edit: Ok, actually, putting android:background in a <fragment> doesn't work, but it will if you put it in the top level element of a layout the fragment inflates.

0

精彩评论

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