Set Linear layout background dynamically

后端 未结 7 2386
南旧
南旧 2021-02-12 18:14

I wanted to set Linear Layout background dynamically in the following way:

  1. Fetch image from web url through XML parsing and then store that image into sd card.<

相关标签:
7条回答
  • 2021-02-12 19:12

    Use @Deimos's answer, but like this since some methods are deprecated now

    Bitmap bmImg = BitmapFactory.decodeStream(is);
    BitmapDrawable background = new BitmapDrawable(context.getResources(), bmImg);
    linearLayout.setBackground(background);
    
    0 讨论(0)
提交回复
热议问题