在 Xamarin.Forms 应用程序的 android 部分禁用 defaultFocusHighlightEnabled [英] Disable defaultFocusHighlightEnabled in the android part for a Xamarin.Forms application

查看:43
本文介绍了在 Xamarin.Forms 应用程序的 android 部分禁用 defaultFocusHighlightEnabled的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 android 8 设备中运行的 xamarin.forms 应用程序中,我想在使用物理键盘时禁用控件突出显示(这是一种新的 android 8 行为)

In a xamarin.forms application running in an android 8 device I want to disable the controls highlights when I'm using a physical keyboard (this is a new android 8 behavior)

android 文档说我应该为此设置 android:defaultFocusHighlightEnabled="false"

The android documentation says that I should set android:defaultFocusHighlightEnabled="false" for that

我尝试将其添加到清单文件中,但突出显示继续出现

I tried to add that in my manifest file but the highlight continues appearing

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:defaultFocusHighlightEnabled="false" android:versionName=

在哪里可以全局设置?

推荐答案

我能够通过评论解决问题

I was able to solve the issue with the comments

在我的styles.xml 文件(在主要活动中引用)中,我在主题中添加了条目

In my styles.xml file (referenced in the main activity) I added the entry in the theme

MainActivity.cs

[Activity(Label = "Sage Service Ops", Icon = "@drawable/icon", MainLauncher = false, Theme = "@style/MyTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity

styles.xml

<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
  <item name="android:actionBarStyle">@style/MyTheme.ActionBarStyle</item>
  <item name="android:defaultFocusHighlightEnabled">false</item>
</style>

这篇关于在 Xamarin.Forms 应用程序的 android 部分禁用 defaultFocusHighlightEnabled的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆