Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change background in android layout

Tags:

android

layout

I want to know how i can change my Layout Background.

like image 279
bhavesh N Avatar asked Mar 19 '26 21:03

bhavesh N


1 Answers

There are multiple ways to accomplish this, it can be done via XML...

  • android:background XML attritube. This can use a drawable in the form of "@drawable/imagefile" or a color value "#FF000000".

or perform the color change programmatically with the following functions:

  • setBackgroundResource: Set the background to a given resource. The resource should refer to a Drawable object or 0 to remove the background.
  • setBackgroundColor: Sets the background color for this view.
like image 184
Will Tate Avatar answered Mar 21 '26 10:03

Will Tate