SKGLView much darker than SKCanvasView - xamarin

My app's main screen is rendered via SKCanvasView. The colors accurately reflect the values I specified in code.
If I swap-in SKGLView (hardware-accelerated version), changing no other code, the result is 60% darker:
<!--<skia:SKCanvasView PaintSurface="OnCanvasViewPaintSurface" />-->
<skia:SKGLView PaintSurface="OnCanvasViewPaintSurface" />
Why is this happening and how do I fix it?

The answer can be found here: https://github.com/mono/SkiaSharp/issues/299#issuecomment-331990904
I found the solution to the problem. There is a specific attribute that is set in the splash screen style, but is not unset (for some reason) when the style is changed.
In the splashscreen style, note this:
<item name="android:backgroundDimEnabled">true</item>
Docs: https://developer.xamarin.com/api/field/Android.Resource+Attribute.BackgroundDimEnabled
This is not unset when the style is switched. So, to fix this, just set it to false:
<item name="android:backgroundDimEnabled">false</item>
Here is a repository that demonstrates this: https://github.com/mattleibow/AndroidGLSurfaceViewTests

Related

Since RelativeLayeout is not recommended to use in .Net Maui, what techniques would replace it?

I used Factor of RelativeLayout in Xamarin.Forms a lot, this way my app UI scaled properly on any device. RelativeLayout is not recommended for use anymore and no replacement offered, so I wonder what would be techniques to indicate for example I want the xaml element to occupy 80% of it's parent element (container)? Should I calculate real width/height of the container in the runtime, depending on the device resolution? Or there is a better solution? I just can find nothing close in .Net Maui to what RelativeLayout+Factor allowed me to do in Xamarin.Forms.
I fear right now there is no way except Creating your own derivate of a Relative Layout. I've got the same problem of converting a Xamarin App to MAUI. There we did use a relative Layout to display various machines at their respective positions inside a building.
I found a few examples on how to create a custom layout here.
I would not recommend using the compatibility namespace. For me it makes problems and upon activating it, some of my page content is no longer displayed.
Hope this helps at least a little.
One option is to use the Grid layout with ColumnDefinitions="*,8*,*".
Place the content in Column 1.
AbsoluteLayout and RelativeLayout now exist only in the compatibility namespace, you can update your code to use them by adding the new namespace, and prefixing your XAML references:
<ContentPage
xmlns:cmp="clr-namespace:Microsoft.Maui.Controls.Compatibility;assembly=Microsoft.Maui.Controls"
...
>
<cmp:AbsoluteLayout>
<BoxView
Color="Red"
cmp:RelativeLayout.XConstraint="{cmp:ConstraintExpression Type=Constant, Constant=0}"
cmp:RelativeLayout.YConstraint="{cmp:ConstraintExpression Type=Constant, Constant=0}" />
</cmp:AbsoluteLayout>
</ContentPage>

Does anyone know how to change the colors of the very bottom area of an Android phone with Xamarin XF?

Here's an example of what I mean
How can I change the color between grey and black depending on settings in my app. I believe am looking for a solution that uses an Android Renderer.
Note that is not a very good picture as the bright white confused my camera. There's actually the Android's back < the square home and another symbol that's showing in that white area. My point is that it's showing very clearly even though I have set Shell.NavBarIsVisible="false" and I don't believe it was appearing before.
Based on your comment try to add in your Android project following line in your styles.xml located resources -> values:
under:
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
add
<item name="android:navigationBarColor">#000000</item>
Please note it won't work on API version < 21

Is there any way to change datepicker border line colour in xamarin

When displaying datepicker in XAML page bottom borderline color is black. I want to change this color to white. How to solve this problem. Is there any custom renderer to set the bottom borderline color. I am using absolute layout in my XAML page. By default when displaying datepicker on my page the date with black bottom borderline color. I just want to change to white color.
I posted an answer yesterday for another user who wanted to change the bottom line color of a text view. You can most likely do it the same way with a custom DatePicker; simply change the background to the xml resource in your custom renderer.
See here:
How can i change editor bottom border line color using custom renderer in xamarin forms
Just change the color values in the XML code to color="white".
You have to create an XML file in drawable folder and add this styling. You can customize it according to the color you want.
Add this file to style of datepicker, Resource.Style.datepicker.
<style name="datepicker" parent="Theme.AppCompat.Light.Dialog">
<item name="colorPrimary">#color/clrDatePrimary</item>
<item name="colorPrimaryDark">#color/clrDatePrimaryDark</item>
<item name="colorAccent">#color/clrDateAccent</item>
</style>

Is it possible to style the color of the font?

I would like to change the default black color of the font to white. I tried to add this to the styling section of my graph:
style request-rejected fill:#e74c3c,color:#FFFFFF;
The background is correctly changed to #e74c3c but the font stays black. It looks however that normal CSS styles are used in the .less source.
Is it possible to change the font color in a graph?
I know that this is a SUPER old post - but just in case someone else ends up here...
Please see Mermaid documentation for information on styling

styling an air application - background image

So I'm trying to give my air application a custom style, I've set the showFlexChrome to false and that's ok it works. now I would like to use an image window I designed in photoshop as the background (because now there is no background in the application).
I did the following but it doesn't work
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:views="be.KHM.ProjectManager.models.views.*"
width="850" height="500" currentState="index" creationComplete="init()"
showFlexChrome="false"
horizontalScrollPolicy="off"
verticalScrollPolicy="off"
backgroundColor="white"
>
< mx:Style>
WindowedApplication
{
backgroundColor: white;
backgroundImage: "be/KHM/ProjectManager/assets/mysimpleproject_interface.jpg";
}
</ mx: Style>
The path is correct and I don't receive any errors but the background of my air app is still transparent. I tried to put a canvas around everything between my windowedapplication and give that a background image, but because I work with states it will give me the error that the states cannot be initiated within a canvas or something like that.
Try putting a ClassReference("be/....") for the backgroundImage style setter.
Edit:
Oh, wait... that's not a class.
The problem could be that you have the wrong combo of showFlexChrome and the FlexChrome property in your xml compiler file.
My suggestion would be to take a look at the source of the SalesForce app that someone built when 1.0 came out. It has some decent css and window styling examples.

Resources