I use this code as mentioned in document of play services for Unity3d.
BannerView bannerView = new BannerView(adUnitId, adSize, AdPosition.Bottom);
The code works, but here is the problem:
For Samsung phones I do not have any problem because, back-home buttons are not on screen. But I have another physical device for testing: LG
For Lg, I got a problem. Back, home etc buttons on screen, so when I use AdPosition.Bottom, It deploys it in bottom but make a space for buttons. So it is not appear in exact bottom.
Do you have suggestions?
Related
I'm showing a notification in my app. I would like the small icon to be white in the status bar but another color (greenish) in the notification itself, as described in this question.
I'm using a 72x72, pure white, transparent, RGB-gamma-color-space PNG file as the icon:
This is how it appears in the status bar:
But it's still white in the notification itself (even though the app title gets the correct color):
This is the code I use to display the notification:
using AndroidX.Core.App;
var builder = new NotificationCompat.Builder(this, "MY_CHANNEL")
.SetSmallIcon(Resource.Mipmap.ic_notification_alert)
.SetContentTitle("Test1")
.SetContentText("This is a test")
.SetColor(GetColor(Resource.Color.colorPrimary));
NotificationManagerCompat.From(this).Notify(777, builder.Build());
I already tried moving the icon to the drawable folder, the mipmap folder and using the tool mentioned in the aforementioned question. I'm testing on a Samsung Galaxy S7 with Android 8.0.0 installed. What am I missing?
Downscaling the icon to exactly 48x48 pixels suddenly made the correct color appear.
I still don't understand this undocumented behavior.
I am trying to show 4 icons for 4 tabs in the bar of my FreshTabbedNavigationContainer using FreshMVVM and Xamarin.Forms of course, they look as they should when I execute the app on an Android emulator, but when I use my Mac and emulate the app on an IOS emulator, these icons become gargantuan, just as you see in this picture.
Here is my code:
FreshTabbedNavigationContainer Code:
private static FreshTabbedNavigationContainer TabbedPageContainer = null;
TabbedPageContainer = new FreshTabbedNavigationContainer(navigation.ToString());
Products = TabbedPageContainer.AddTab<HomeViewModel>(null, "IconHomeInverted.ico", null);
Discover = TabbedPageContainer.AddTab<HomeViewModel>(null, "IconMagnifyingGlassInverted.ico", null);
Account = TabbedPageContainer.AddTab<HomeViewModel>(null, "IconUserInverted.ico", null);
Settings = TabbedPageContainer.AddTab<HomeViewModel>(null, "IconSettingsInverted.ico", null);
#region UI
//Dissables swipe only in android because in IOS can not be done
TabbedPageContainer.On<Xamarin.Forms.PlatformConfiguration.Android>().SetIsSwipePagingEnabled(false);
TabbedPageContainer.BarTextColor = Color.FromHex("#FFFFFF");
#endregion
page.CoreMethods.SwitchOutRootNavigation(navigation.ToString());
My icons are located in "MyProject.IOS", they are not in the resources folder or anything like that.
That is all, if you need more information I will provide it as soon as I see your request. I hope all of you have a great day.
Ok, I solved it, my icons were 500x500 aprox, on Windows, visual studio or fresh MVVM resize the image to fill the tabbed bars; this does not happen on Mac, so they were showing their actual size, I resized them to 38x38 and now they look like what I was looking for.
The iOS "Human Interface Guidelines" have suggested sizes for the custom icons in the Navigation Bar.
These sizes go from 24px to 28px for the #1x scale factor meaning that for the other scale factors we will have something like:
24px
48px#2x
72px#3x
28px
56px#2x
84px#3x
Of course, you are capable of adjusting these numbers to keep consistency across your application.
More information about this here
Hope this helps.-
I have an app that displays video in a subview and where it would be nice to give the option to display that video on a second screen such as an Apple TV and be able to use that freed-up space to show additional controls.
I've found all sorts of help about how to do that, but I'm hitting a wall even before getting out of the starting gate.
In order to detect that the app has started up in a multiple display environment, all the sample code features a line like...
if (UIScreen.Screens.Length > 1) {
// ...
}
(I'm doing this in C#/Xamarin, though I doubt the problem is related to that; anyway, the snippets are in C#)
My problem is that the array of screens is always 1 no matter what I do. The iPad is running iOS 11.2.5, and if I turn on mirroring, the iPad is mirrored, but , again, the array of screens only has a single item.
There are also a couple of observers to detect screens being added/removed while the app is running. I haven't seen Xamarin specific code, but I presume it looks like:
NSNotificationCenter.DefaultCenter.AddObserver(this, UIScreen.DidConnectNotification, NSKeyValueObservingOptions.New, IntPtr.Zero);
NSNotificationCenter.DefaultCenter.AddObserver(this, UIScreen.DidDisconnectNotification, NSKeyValueObservingOptions.New, IntPtr.Zero);
Anyway, those never fire even if I add/remove the Apple TV or enter/exit Mirroring Mode on the iPad.
Oh; also if I do
avPlayer.AllowsExternalPlayback = true;
avPlayer.UsesExternalPlaybackWhileExternalScreenIsActive = true;
then that works as expected, too. The video now appears full-screen on the Apple TV and the UIView on the iPad containing the avPlayer greys out rather than showing the video.
However, that's not what I'm looking for. I would like to control the layout of both screens and that does neither. (While I do want the video to be full screen on the Apple TV, I don't want it to be an AVPlayerViewController and I do want to repurpose the screen real-estate taken up by the iPad video view)
At the end of the day, all I think I need is to manage to get
UIScreen.Screens.Length to be equal to 2 when I launch the app.
What's the secret of getting UIScreen to detect/report a second display?
When an app is launched with screen mirroring already enabled, the UIScreen.screens array initially only contains the device's screen. Shortly after launch, iOS posts a UIScreenDidConnect notification to advise your app that a second screen is connected.
What you will see at launch is that the captured property of your main screen is true if mirroring is enabled, however you can't actually access the second screen until after the notification is posted. Note that captured could also indicate that screen recording is in progress.
Although this seems slightly counter-intuitive it actually makes your coding a little simpler; you need to observe the UIScreenDidConnect and UIScreenDidDisconnect notifications anyway and now you don't need to write any special code to handle the case where the app is launched with a second screen already attached.
You can use something like this in your didFinishLaunching:
let nc = NotificationCenter.default
nc.addObserver(forName: NSNotification.Name.UIScreenDidConnect, object: nil, queue: nil) { (notification) in
print("Screen connected")
self.enableExternalDisplay()
}
nc.addObserver(forName: NSNotification.Name.UIScreenDidDisconnect, object: nil, queue: nil) { (notification) in
print("Screen disconnected")
self.disableExternalDisplay()
}
UPDATE
Actually, it looks like you have the key/value observing format of AddObserver in your code, when you actually want notification observing. Something like:
NSNotificationCenter.DefaultCenter.AddObserver(UIScreen.DidConnectNotification,OnScreenConnected)
And then you need to implement an OnScreenConnected method.
I'm trying to test a swipe across an image gallery on a responsive website. On a mobile device it would be a finger swipe, using a desktop browser it functions the same with a mouse click/hold/drag. It's the desktop browser functionality I'm trying to replicate.
The code I have is:
Driver.Navigate().GoToUrl(Properties.Settings.Default.TestPage);
var mainImage = Driver.FindElement(By.CssSelector(".main-image"));
var imageAcross = (mainImage.Size.Width / 4 ) * 3;
var imageDown = mainImage.Size.Height/2;
var builder = new Actions(Driver);
builder.MoveToElement(mainImage, imageAcross, imageDown).ClickAndHold().Build().Perform();
TakeScreenshot(TestContext.CurrentContext.Test.Name);
builder.MoveByOffset(-imageDown, 0).Release().Build().Perform();
TakeScreenshot(TestContext.CurrentContext.Test.Name);
The TakeScreenshot function, as the name suggests, saves a screenshot. I take one before and after the move.
The first builder.MoveToElement places the cursor where I would expect and after the builder.MoveByOffset the cursor has moved as expected. However the swipe didn't change the gallery image. It's as if the ClickAndHold was ignored.
The CSS element .main-image is a div tag that has Javascript attached that changes an image within it on the swipe. The browser I'm using for testing is PhantomJS.
Is there something I am doing wrong? Or any suggestions on how to get the swipe to work?
I'm using xcode and I have a tabbarcontroller with multiple views.
I just added admob and added the ads to each view (in - (void)viewDidLoad) using this code:
AdViewController *myAdsVC = [[AdViewController alloc] init];
[self.view addSubview: myAdsVC.view];
AdViewController is the admob view.
The problem is, when the ad shows up, half the screen can't be used. The app runs fine, but the middle of the screen can't click, scroll, or do anything. I can scroll above and below the space.
i've attached an image showing the space that is frozen.
http://i.imgur.com/fN95g.png
You should try setting the frame of the myAdsVC to something like:
myAdsVC.view.frame = CGRectMake(0, 0, 320, 50);