xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] [Android] Visual=Material ignores color accent + unreadable by default in dark theme #14000

Open inimirpaz opened 3 years ago

inimirpaz commented 3 years ago

Description

(See screenshot, possibly related to https://github.com/xamarin/Xamarin.Forms/issues/13809 ) When using Xamarin.Forms.Visual.Material and the controls' Visual is set to Material, the color accent defined in the Android file values/styles.xml ( <item name="colorAccent"> ) is ignored. In addition (new issue?), the default rendering of a Visual="Material" component when displayed when dark theme is enabled, is barely unreadable (dark font on a dark background)

Steps to Reproduce

  1. Define a control such as Entry or Picker
  2. Set Visual="Material"

Expected Behavior

The user defined color accent in <item name="colorAccent"></item> should be used. Also, the default coloring of the UI components in Android with Dark Theme on, should be more readable.

Basic Information

Environment

Visual Studio Community 2019 for Mac
Version 8.9.1 (build 34)
Installation UUID: ab28aaad-80b7-46fa-9a1e-b2e33af1cf89
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

    Package version: 612000122

Mono Framework MDK
Runtime:
    Mono 6.12.0.122 (2020-02/c621c35ffa0) (64-bit)
    Package version: 612000122

Roslyn (Language Service)
3.9.0-6.21152.10+c10f884b30737542ddd84ca889a4aad9281ce210

Xamarin.Android
Version: 11.2.0.21 (Visual Studio Community)
Commit: xamarin-android/d16-9/93eab59
Android SDK: /Users/mpazzaglia/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        5.0 (API level 21)
        8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 31.0.0
SDK Build Tools Version: 30.0.2

Build Information: 
Mono: 5e9cb6d
Java.Interop: xamarin/java.interop/d16-9@d6d86b2
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.34.1@daff8f4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-9@9d8924d

Microsoft OpenJDK for Mobile
Java SDK: /Users/mpazzaglia/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Screenshots

Please notice that the Picker (Visual=Material) has a dark colored lower bar instead of a red one. Registrazione schermo 2021-03-12 alle 10 34 10

Reproduction Link

VisualMaterialBug1.zip

Workaround

Does not solve the issue, but defining a

    <style name="XamarinFormsMaterialTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
    </style>

in the styles.xml, prevents the defaut Android color accent for the dark theme to be used.

jsuarezruiz commented 3 years ago

cc @PureWeen

jsuarezruiz commented 3 years ago

Related with https://github.com/xamarin/Xamarin.Forms/issues/11652