Xamarin Forms where to change StatusBar For Android and IOS - xamarin.forms

I'm using Xamarin.Forms and want to Navigation in all pages to have #84DCC6. It adds but i dont want to have the blue color on top (which is default in Android project )of The navigation page, i want to have just one color #84DCC6. This is my code in App.xaml
<Application.Resources>
<ResourceDictionary>
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="#84DCC6" />
<Setter Property="BarTextColor" Value="Black" />
</Style>
</ResourceDictionary>
</Application.Resources>
I'm testing my App on Xiaomi A2 Lite. Any suggesstions to be just one color #84DCC6

The blue color you are talking about is not a navigation bar, its a status bar.
Android:
you can change its color from Styles.xml file situated under your android project Resource folder:
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#1eb6ed</item>
iOS
use this below code inside your app delegate class
var statusBar = UIApplication.SharedApplication.ValueForKey(new NSString("statusBar")) as UIView;
if (statusBar.RespondsToSelector(new ObjCRuntime.Selector("setBackgroundColor:")))
{
statusBar.BackgroundColor = UIColor.FromRGB(132, 220, 198);
statusBar.TintColor = UIColor.Black;
}

Related

Picker in React-native

Just started learning React-native.
I'm getting stuck on the picker component.
Picker not working on react-native": "0.68.2
I installed it --> npm i #react-native-picker/picker
Imported --> import {Picker} from '#react-native-picker/picker';
But still getting error message
#react-native-picker/picker could not be found within the project or in these directories: node_modules ..\node_modules
Tried a simple program to list languages, not working!
class testingPicker extends Component {
state = {
language:'a'
}
render(){
return(
<View>
<Picker
style={{width:'100%'}}
>
{/* Adding options to picker */}
<Picker.Item label="A" value="a"/>
<Picker.Item label="B" value="b"/>
</Picker>
</View>
)
}
}
export default testingPicker;
User "react-native-picker-select" library for picker in react native
For more details Visit
https://blog.logrocket.com/how-to-use-react-native-picker-select/

How to fix Xamarin.Forms iOS color disparity on TitleBar image VS TitleBar background when Android does not have this issue

I have an Image (that is the size of a banner) that has a background color #F6D401 and needs to go to TopBar, for branding.
in App.xaml I set:
<Application.Resources>
<ResourceDictionary>
<Color x:Key="Primary">#f6d401</Color>
<Color x:Key="TextColor">#5a5a5a</Color>
Then in AppShell.xaml
<Shell.Resources>
<ResourceDictionary>
<Style x:Key="BaseStyle" TargetType="Element">
<Setter Property="Shell.BackgroundColor" Value="{StaticResource Primary}" />
<Setter Property="Shell.ForegroundColor" Value="{StaticResource Primary}" />
Then on pages:
<Shell.TitleView>
<Image
HorizontalOptions="Center"
VerticalOptions="Center"
Source="logo.png" />
</Shell.TitleView>
On Android I get a background banner and all the colors the same color, which is exactly what I want and what is expected.
on iOS, however, colors do not seem to match
I am assuming there is a default setting on iOS somewhere that is doing this, that needs to be changed.
How do I make banner and icon colors to match?
Please add UINavigationBar.Appearance.Translucent = false; to AppDelegate.cs
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
UINavigationBar.Appearance.Translucent = false;
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
}
Here is running screenshot.

Xamarin Forms Shell titlebar color not set correctly in dark theme

I have a xamarin forms shell application. I set the titlebar color with this style:
<Color x:Key="BackgroundColorDark">#121212</Color>
<Color x:Key="BackgroundColorLight">#EFF2F5</Color>
<Color x:Key="TextPrimaryColor_Dark">#FFFFFF</Color>
<Color x:Key="TextPrimaryColor_Light">#323130</Color>
<Style x:Key="BaseStyle"
TargetType="Element"
ApplyToDerivedTypes="True">
<Setter Property="Shell.BackgroundColor"
Value="{AppThemeBinding Dark={StaticResource BackgroundColorDark}, Light={StaticResource BackgroundColorLight}}" />
<Setter Property="Shell.ForegroundColor"
Value="{AppThemeBinding Dark={StaticResource TextPrimaryColor_Dark}, Light={StaticResource TextPrimaryColor_Light}}" />
<Setter Property="Shell.DisabledColor"
Value="#B4000000" />
<Setter Property="Shell.UnselectedColor"
Value="#CC0000" />
<Setter Property="Shell.NavBarHasShadow"
Value="false"/>
</Style>
In light theme this works as expected and it is the same as the background:
But in dark theme it seems the title bar has a different color:
Since it looks as if the title bar is translucent I tried to explicitly deactivate that with the ios specific setting on the navigation page but that didn't work.
ios:NavigationPage.IsNavigationBarTranslucent="true"
How can I apply the background color in dark theme correctly?
Xamarin Forms Version: 4.8.0.1269
Source Code Repository: https://github.com/NPadrutt/MoneyFox.Windows/tree/mobile-redesign
In the iOS.project, you can set UINavigationBar.Appearance.Translucent = false; in FinishedLaunching method to remove the default alpha.
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
UINavigationBar.Appearance.Translucent = false;
return base.FinishedLaunching(app, options);
}
}

Error while try to add splash screen to Xamarin forms -Xamarin Android

I am trying to create a splash screen to my app.
I am using Xamarin forms, and I currently testing only in Android
However I am receiving this 2 errors
1)Failed to generate resource table for split '' "Failed to generate resource table for split ''".
Severity Cod'android:windowBackground' with value '#drawble/splashscreen'.
will appreciate any help to solve this issue
thanks.
here is my styles.xml:
<resources>
<style name="Theme.splash" parent="android:Theme">
<item name="android:windowBackground">#drawble/splashscreen</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<!-- Base theme applied no matter what API -->
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without
android:-->
<item name="windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<!-- Set theme colors from
http://www.google.com/design/spec/style/color.html#color-color-palette -->
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#2196F3</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#1976D2</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">#FF4081</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal. -->
<item name="windowActionModeOverlay">true</item>
<item name="android:datePickerDialogTheme">#style/AppCompatDialogStyle</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FF4081</item>
</style>
</resources>
and here is the code I added to Activity:
[Activity(Label = "SplashScreen", MainLauncher=true, NoHistory=true, Theme = "#style/Theme.splash")]
public class SplashScreen : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
StartActivity(typeof(MainActivity));
}
}
and this is the main acitivity:
[Activity(Label = "RegestrationAppComp", Icon = "#drawable/icon", Theme = "#style/MainTheme", MainLauncher = false, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
}
When you create your splashscreen.xml file, you must change its properties. I've followed these steps:
Right click the splashscreen.xml file and select Properties, a window will show up at the bottom.
On the field Build Action, change the value to AndroidResource
On the field Custom Tool, write MSBuild:UpdateGeneratedFiles (or copy what's written on other files above in the same folder or from the values/styles.xml file.
Please add your image(in your case image file name is "splashscreen") in drawable folder using visual studio. For this, you have to right click on "Drawable" folder -> click on "Add Existing Item" -> select your image from your laptop/PC drive location and click on "Add".. Thats it !!! Now you can build and deploy solution again..

fullcalendar backgroundColor property

I'm trying to add a background color to an event but with no luck.
$('#calendar').fullCalendar('renderEvent', { id: 1, title: 'hello', start: selected_date, allDay: true, color: '#FF0000', backgroundColor: '#000000' }, false);
Any idea why this won't work? The border color seems to work but not the backgroundColor
If you add both the stylesheets then the backgroundColor will not work.
<link rel="Stylesheet" type="text/css" href="/Content/fullcalendar/fullcalendar.css" />
<link rel="Stylesheet" type="text/css" href="/Content/fullcalendar/fullcalendar.print.css")" />
After removing the fullcalendar.print.css then the backgroundColor decided to render correctly.
Add the media attribute
<link href="../css/fullcalendar/fullcalendar.css" rel="stylesheet" type="text/css" />
<link media='print' href="../css/fullcalendar/fullcalendar.print.css" rel="stylesheet" type="text/css" />
I was setting it up in my bundle config in asp but that didn't add the media property so it was an issue.
The background color for events is defined in the fullcalendar.css file under the section
/* Global Event Styles
(Line 261, in version 2.0 beta)
You can access it programmatically like this:
$('.fc-event').css('background-color','#3a87ad');
Try to make it stick (change false parameter to true, at the end), probably a new event is overlapping and make it change properties.
"Normally, the event will disappear once the calendar refetches its event sources (example: when prev/next is clicked). However, specifying stick as true will cause the event to be permanently fixed to the calendar.", from Documentation, http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/
Here is how I did it: I placed backgroundColor in the chart event:
chart: {
type: 'column',
backgroundColor: 'transparent'
},
try this may be it works for you.
background: '#eeeef0
Do not write backgroundColor.

Resources