Android setting LinearLayout background programmatically

后端 未结 6 890
一整个雨季
一整个雨季 2021-02-06 02:34

I have a situation where I need to set a background on a LinearLayout programatically.

In my layout, I am setting my background using `android:background=\"?android:att

6条回答
  •  一整个雨季
    2021-02-06 03:08

    try this line

    rootLayout.setBackgroundResource(d);
    

    instead of

    rootLayout.setBackgroundDrawable(d);
    

提交回复
热议问题