Android Webview删除蓝色链接边框 [英] Android webview remove blue link border

查看:130
本文介绍了Android Webview删除蓝色链接边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用程序中使用Webview时,每次单击链接时,蓝色框都会突出显示文本或图像.反正有从Webview中删除此功能吗?

When using webview in my application, everytime I click on a link a blue box highlights the text or image. Is there anyway of removing this feature from webview?

推荐答案

出于可访问性原因,您不应该只是将水龙头高亮颜色设置为透明.

For accessibility reasons you shouldn't just blanket set the tap highlight color to transparent.

对于需要完全控制的元素:

For elements where you want full control:

1.)删除水龙头高亮颜色

1.) Remove the tap-highlight-color

.btn {
    ....

    -webkit-tap-highlight-color: transparent;
}

2.)添加一个新的:active 状态(在此示例中,设置背景色

2.) Add a new :active state (in this example set a background color

.btn:active {
    background-color: rgba(100, 100, 100, 1.0);
}

3.)在某些元素上,例如您可能会看到蓝色或橙色边框,这只是处于焦点状态,以删除边框:

3.) On some elements like you may see a blue or orange border, this is just to the focus state, to remove the border:

.btn {
    ....
    -webkit-tap-highlight-color: transparent;
    outline: 0;
}

4.)添加:focus 状态

.btn:focus {
    background-color: rgba(200, 200, 200, 1.0);
}

5.)要获得奖励积分,请添加:focus:active 状态

5.) For bonus points add a :focus:active state

.btn:focus:active {
    background-color: rgba(150, 150, 150, 1.0);
}

这篇关于Android Webview删除蓝色链接边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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