androidxamarinxamarin.formsandroid-listviewmaui

Disable ViewCell long press loading animation on Android .Net Maui


I want to disable the loading animation shown on an Android native ViewCell when the user long presses it. I was able to disable the highlighting of the ViewCell on click by implementing the following on resources/values/styles.xml

<style name="Maui.MainTheme" parent="Theme.MaterialComponents.DayNight">
    <item name="android:colorActivatedHighlight">@android:color/transparent</item>
    <item name="android:colorLongPressedHighlight">@android:color/transparent</item>
    <item name="android:colorActivatedHighlight">@android:color/transparent</item>
</style>

and including in my MainActivity like this

[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]

However, I am unable to remove the loading animation. I came across this post with a similar question but potential solutions have not been provided.


Solution

  • You can modify colorControlHighlight:

    <resources>
       <style name="Maui.MainTheme" parent="Theme.MaterialComponents.DayNight">
           <item name="android:colorActivatedHighlight">@android:color/transparent</item>
           <!--Add this code-->
           <item name="android:colorControlHighlight">@android:color/transparent</item>
       </style>
    </resources>