creating a drawable from sd card to set as a background in android

前端 未结 3 648
北恋
北恋 2021-01-03 10:18

I am trying to use an image from the sd card and set it as the background for a relativelayout. I have tried other solutions that i have found here and elsewhere but they h

3条回答
  •  执念已碎
    2021-01-03 10:36

    I suggest checking that the drawable is being loaded correctly. Some things to try:

    • Try using a different image on the sd card
    • Put pic.png in R.drawable and make sure mRoot.setBackgroundResource() does what you expect
    • After loading the drawable, check d.getBounds() to make sure it is what you expect

提交回复
热议问题