Questions tagged [background]

Background typically refers to the rendering behind a container element's contents - usually on a web page, Windows form or other UI presentation medium.

In CSS, the background property is a shorthand property for setting the individual background property values in a single place in the style sheet. This includes the image, color, tiling and position.

In Windows Presentation Foundation (WPF), the background attribute can be defined for any visual UI object. It should be noted that WPF applications use a background thread for handling rendering and repainting.

Desktop applications such as those written in .Net and Java may have colors or images used to fill the window of a particular frame or form.

For information about background threading, see the multithreading wiki.

14013 questions
883
votes
22 answers

Stretch and scale a CSS image in the background - with CSS only

I want that my background image stretch and scale depending on the browser viewport size. I've seen some questions on Stack Overflow that do the job, like Stretch and scale CSS background for example. It works well, but I want to place the image…
Fábio Antunes
  • 15,931
  • 17
  • 68
  • 94
553
votes
26 answers

How do I run a node.js app as a background service?

Since this post has gotten a lot of attention over the years, I've listed the top solutions per platform at the bottom of this post. Original post: I want my node.js server to run in the background, i.e.: when I close my terminal I want my server…
Peter Kruithof
  • 9,284
  • 5
  • 27
  • 42
409
votes
44 answers

How to detect when an Android app goes to the background and come back to the foreground

I am trying to write an app that does something specific when it is brought back to the foreground after some amount of time. Is there a way to detect when an app is sent to the background or brought to the foreground?
iHorse
  • 4,109
  • 3
  • 13
  • 4
315
votes
13 answers

How set background drawable programmatically in Android

To set Background: RelativeLayout layout =(RelativeLayout)findViewById(R.id.background); layout.setBackgroundResource(R.drawable.ready); Is the best way to do it?
Chad Bingham
  • 28,578
  • 19
  • 82
  • 110
302
votes
27 answers

How to get div height to auto-adjust to background size?

How do I get a div to automatically adjust to the size of the background I set for it without setting a specific height (or min-height) for it?
JohnIdol
  • 45,251
  • 58
  • 153
  • 235
299
votes
17 answers

What is the difference between background and background-color

What's the difference between specifying a background color using background and background-color? Snippet #1 body { background-color: blue; } Snippet #2 body { background: blue; }
stanigator
  • 10,102
  • 32
  • 88
  • 126
264
votes
9 answers

How to make gradient background in android

I want to create gradient background where the gradient is in the top half and there's a solid color in the bottom half, like in this image below: I can't because the centerColor spreads out to cover the bottom and top. How can I make a…
kongkea
  • 9,062
  • 11
  • 37
  • 47
259
votes
12 answers

setBackground vs setBackgroundDrawable (Android)

I want to set background drawable of a view. There are two methods for this (as far as I see): setBackground and setBackgroundDrawable. When I use setBackground, it says it has been added in API level 16 but my project's min SDK version is 7. I…
Pijusn
  • 10,225
  • 7
  • 49
  • 74
185
votes
12 answers

CSS: background image on background color

I have panel which I colored blue if this panel is being selected (clicked on it). Additionally, I add a small sign (.png image) to that panel, which indicates that the selected panel has been already selected before. So if the user sees for example…
mkn
  • 9,616
  • 17
  • 45
  • 61
184
votes
21 answers

How to set background color of a View

I'm trying to set the background color of a View (in this case a Button). I use this code: // set the background to green v.setBackgroundColor(0x0000FF00 ); v.invalidate(); It causes the Button to disappear from the screen. What am I doing wrong,…
Peter vdL
  • 4,765
  • 9
  • 37
  • 59
181
votes
6 answers

Stretch background image css?

This is my CSS…
Buffon
  • 3,063
  • 5
  • 18
  • 14
168
votes
23 answers

Android WebView style background-color:transparent ignored on android 2.2

I'm struggling to create a WebView with transparent background. webView.setBackgroundColor(0x00FFFFFF); webView.setBackgroundDrawable(myDrawable); Then I load a html page with
jptsetung
  • 8,668
  • 3
  • 38
  • 49
155
votes
2 answers

How do I set a Windows scheduled task to run in the background?

Does anyone know how to set a scheduled task to run in background using Windows Task Scheduler? There doesn't seem to be any option to do this.
Samuel Liew
  • 68,352
  • 105
  • 140
  • 225
154
votes
14 answers

SwiftUI - How do I change the background color of a View?

I'm beginning to try out SwiftUI and I'm surprised that it doesn't seem to be straightforward to change the background color of a View. How do you do this using SwiftUI?
jeremyabannister
  • 2,362
  • 3
  • 11
  • 19
152
votes
13 answers

Full screen background image in an activity

I see many applications that use a full-screen image as background. This is an example: I want to use this in a project, the best way I've found so far to do this is to use an image with a large size, put it in a ImageView and use android:…
Sergio76
  • 3,594
  • 13
  • 55
  • 84
1
2 3
99 100