I need to set the background of a window to be transparent programmatically, once the window is already created.
This creates a new window with a transparent background.
Titanium.UI.createWindow({url:location.href,transparentBackground:true}).open()
Background transparency can also be set in the tiapp.xml, but I need to set it after the window is loaded.
I also tried the following
var win = Titanium.UI.getCurrentWindow();
win.backgroundColor = 'transparent';
which does not have any effect...
Is there a way to achieve that?
Perhaps you could create 2 windows with the same components, one transparent and one not. Once you want the transparent background to show close the other window?
or win.setBackgroundColor('transparent');
I pasted your code into a click event and it worked fine for me. All i did was change the url to 'app://index.html' for testing purposes.
$('.button').click(function(){
// test
Titanium.UI.createWindow({url:'app://index.html',transparentBackground:true}).open();
});
Have you opened the web inspector to check for js errors?
If you want the initial window to be transparent, add this
<transparent-background>false</transparent-background>
to
<window />
on the tiapp.xml file.
Related
When the React Native app is running at first, there is a white view like the screenshot bellow, how can i change that view's background color? I cannot find the activity in Xcode.
Because in some cases, i restart the app, and users sees a flash (the white screen above), so i need to change the background color.
Thanks in advance.
I just found it in AppDelegate.m
rootView.backgroundColor = [[UIColor alloc] initWithRed:0.0f green:0.64f blue:0.87f alpha:1];
Try changing the LaunchScreen file. It's the first thing that shows up when your app opens (If your bundling takes too long, you will see the white screen again. IMO the best practice is to use splash screen.
Using splash screen, you can dismiss the Splash View (probably an image) in your componentDidMount() function like below.
componentDidMount() {
// do anything while splash screen keeps, use await to wait for an async task.
SplashScreen.hide();
}
Also note that, in production release, there will be no bundling from the local server, so no need to worry that for now.
how can i change the theme or default background color for ios.. it's conflicting with my background image. I'd like to set it to transparent.. Thanks
First let's understand how scenes in react-native-router-flux works. When you define them in your navigator, like below,
<Scene sceneStyle={{marginTop: 64}} title="Home" key="home" component={Home} />
You simply say that, my content should render below the pre defined navbar. Which can be 54 or 64 depending on your OS. So when you use Router,
<Router navigationBarStyle={{backgroundColor: 'transparent'}}>
and add navigationBarStyle to every Scene you have by introducing that line, you almost forgot what you've done above, setting your Scene to align itself some margin below the navigationBar. Therefore you see nothing (white space) in your simulator.
In order to have what you need, do this where you want your image to appear full screen with navigation controls:
Actions.refresh({
key: 'home',
navigationBarStyle: {backgroundColor: 'transparent'},
sceneStyle: {marginTop: 0},
});
Or you can introduce this settings in your Scene component where you define it.
I tested this solution and it works on iOS, can't tell the same for Android, so please back up your code before making changes. You can further customize it to remove borderBottom line.
I want to set an image as background Textbox in Corona. Help me. Thanks.
Try set
obj.hasBackground = false
and then simply display the background color/image you want in the position of the field.
I think it can not be tested on Corona sim. Use real device.
I am trying to find a way to revert back to the system default color programmatically for iOS components using code. The only other way would be to use 2 controls - 1 set to either color and switch them.
Any info is appreciated. Thanks.
I tried below code in order to change the background of a button to its default color and it worked for me
submitBtn.backgroundColor = UIColor.clear
I need a black temporary transparent box that must show something like "Loading...." with a spinner it. We can see such a view in twitter when "Tweeting" an update - it says "Sending tweet..." kinda thing.
Is this an inbuilt behavior in UIKit. How do I get this box to show up on screen for a few seconds and disappear.
please help.
You need to use DSActivityView. All this is handled there. Instead of doing your own thing I suggest you use this.
For what you need this is how you need to go -
#import "DSActivityView.h"
[DSActivityView activityViewForView:self.view withLabel:#"Tweeting"]; //to show spinner with label
[DSActivityView removeView]; //once its done
You can also try using MBProgressHud