background image not repeating in android layout

前端 未结 4 1181
庸人自扰
庸人自扰 2020-12-08 04:54

i\'ve used the following code to repeat the image in the background but its not working can any one help?

Layout.xml



        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 05:37

        try{ BitmapDrawable background = (BitmapDrawable) myView.getBackground();
        background.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); }
        catch(Exception e) { /*Do nothing; background is not BitmapDrawable; can be a color or null...*/ }
    

提交回复
热议问题