Stretch background image css?

.style1 { background: url(images/bg.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } Works in: Safari 3+ Chrome Whatever+ IE 9+ Opera 10+ (Opera 9.5 supported background-size but not the keywords) Firefox 3.6+ (Firefox 4 supports non-vendor prefixed version) In addition you can try this for an IE solution filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=”https://stackoverflow.com/questions/5662735/.myBackground.jpg”, … Read more

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

Screen’s Background Color (As of Xcode Version 13) I’m not sure if the original poster meant the background color of the entire screen or of individual views. So I’ll just add this answer which is to set the entire screen’s background color. Using ZStack var body: some View { ZStack { Color.purple .ignoresSafeArea() // Your … Read more

setBackground vs setBackgroundDrawable (Android)

It’s deprecated but it still works so you could just use it. But if you want to be completly correct, just for the completeness of it… You’d do something like following: int sdk = android.os.Build.VERSION.SDK_INT; if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) { setBackgroundDrawable(); } else { setBackground(); } For this to work you need to set buildTarget api … Read more

How to make gradient background in android

Visual examples help with this kind of question. Boilerplate In order to create a gradient, you create an xml file in res/drawable. I am calling mine my_gradient_drawable.xml: <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android”> <gradient android:type=”linear” android:angle=”0″ android:startColor=”#f6ee19″ android:endColor=”#115ede” /> </shape> You set it to the background of some view. For example: <View android:layout_width=”200dp” android:layout_height=”100dp” android:background=”@drawable/my_gradient_drawable”/> type=”linear” … Read more

What is the difference between background and background-color

Premising that those are two distinct properties, in your specific example there’s no difference in the result, since background actually is a shorthand for background-color background-image background-position background-repeat background-attachment background-clip background-origin background-size Thus, besides the background-color, using the background shorthand you could also add one or more values without repeating any other background-* property more … Read more

How set background drawable programmatically in Android

layout.setBackgroundResource(R.drawable.ready); is correct. Another way to achieve it is to use the following: final int sdk = android.os.Build.VERSION.SDK_INT; if(sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) { layout.setBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.ready) ); } else { layout.setBackground(ContextCompat.getDrawable(context, R.drawable.ready)); } But I think the problem occur because you are trying to load big images. Here is a good tutorial how to load large bitmaps. … Read more

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

2018: Android supports this natively through lifecycle components. March 2018 UPDATE: There is now a better solution. See ProcessLifecycleOwner. You will need to use the new architecture components 1.1.0 (latest at this time) but it’s specifically designed to do this. There’s a simple sample provided in this answer but I wrote a sample app and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)