天道酬勤,学无止境

android-chrome

Font size display issue on Google Chrome for Android

I have a webpage where the font-size of body 16px. On Google Chrome for Android, I have the following problem: When the page initially loads, the font size in elements which don't have a font-size defined (and therefore inherit the font-size from the body) is bigger than 16px (as you will see if you read on, there is no obvious way to calculate the multiple to which the size of the rendered text is bigger). When the user scrolls down the rendered text size changes to 16px. See the two images below for a visualisation In the above screenshot the page has loaded and the user has not interacted

2021-06-23 11:47:36    分类:问答    android   html   css   font-size   android-chrome

Android Oreo WebView renders layout too small after 2nd loading

On some Android Oreo devices, when I load an url on webview for the first time, the URL page loads properly. However, when I load the URL again, the page is zoomed out. On devices lower than android oreo, the page loads properly for all devices. Also, when you kill the app on the background and load again, the URL loads properly. On the second and succeeding tries, it shows the zoomed out version again. I attached the images of loaded URL below Below is the correct loading of webpage on the webview Below is the small display of webpage on webview webview Android XML Code: <WebView android:id="

2021-06-03 20:58:07    分类:问答    android   android-webview   android-8.0-oreo   android-chrome

SpeechSynthesis in Android-Chrome: cannot change English voice from US English

I'm using the speech synthesis API on Android-Chrome. The issue is that although there are 4 English voices available, it is always US English that is used by the browser, no matter what the code specifies. I can use other languages e.g. French, just not other English voices e.g en-AU, GB, or IN. This code filters British English voice objects from the getVoices array and uses the first to utter the word 'tomato'. The problem is that the word is always pronounced "to-may-lo" not "to-mar-to" which means my text doesn't rhyme as it should. The voice object that was used is displayed and (on the

2021-05-02 16:19:19    分类:问答    javascript   text-to-speech   speech-synthesis   android-chrome

Android Chrome browser address bar shifts fixed element hitareas

It seems Android Chrome has a pretty major bug where sometimes the address bar hiding/showing causes fixed elements to shift their bounding box down/up by the browsers address bar height. So the elements visually stay in the same spot, however the bounding box actually shifts. This renders clickable areas useless as they don't register anymore (see images below). The bug is intermittent, but I've been able to replicate it pretty reliably by scrolling quickly and then abruptly stopping the scroll the touching the screen. Has anyone else encountered this and more importantly, does anyone have a

2021-04-26 18:09:21    分类:问答    javascript   html   css   google-chrome   android-chrome

Get Android Chrome Browser Address bar height in JS

How do I get the height of the address bar in JavaScript in the Chrome browser for Android (marked by red rectangle in left picture)? I need to know that as it disappears while scrolling down and I need to react to that because the viewport height is different then. One solution I already figured out: Get viewport height at initial state: var height = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); Get viewport height when the address bar has disappeared Compute difference between both values Problem is that you have to be in the second state to know that.

2021-04-19 02:33:43    分类:问答    javascript   html   css   google-chrome   android-chrome

Android-WebView语言在Android 7.0及更高版本上突然改变(Android - WebView language changes abruptly on Android 7.0 and above)

问题 我有使用主要语言英语和次要语言阿拉伯语的多语言应用程序。 如文档中所述, 我在清单中添加了android:supportsRtl="true" 。 我已经将所有具有xml属性的属性分别设置为left和right ,分别设为start和end 。 我在strings-ar添加了阿拉伯语言字符串(对于其他资源也是如此)。 上面的设置可以正常工作。 将Locale更改为ar-AE ,阿拉伯文和资源会正确显示在我的活动中。 但是,每次我使用WebView和/或WebViewClient导航到Activity时,语言环境,文本和布局方向都会突然恢复为设备默认值。 进一步的提示: 这仅在具有Android 7.0的Nexus 6P上发生。 一切在Android 6.0.1及更低版本上均可正常运行。 仅当我导航到具有WebView和/或WebViewClient (并且我有多个)的Activity ,才会发生语言环境的突然变化。 在任何其他活动上都不会发生。 Android 7.0具有多语言环境支持,允许用户设置多个默认语言环境。 因此,如果我将主要语言环境设置为Locale.UK : 然后,在导航到WebView ,语言环境从ar-AE更改为en-GB 。 Android 7.0 API更改: 如API更改列表中所示,与语言环境有关的新方法已添加到API 24中的以下类: Locale

2021-03-30 15:22:02    分类:技术分享    android   android-webview   locale   android-7.0-nougat   android-chrome

Android - WebView language changes abruptly on Android 7.0 and above

I have a multilingual app with primary language English and secondary language Arabic. As described in the documentation, I have added android:supportsRtl="true" in the manifest. I have changed all xml properties with left and right attributes to start and end respectively. I have added Arabic language strings in strings-ar (and similarly for other resources). The above setup works properly. After changing the Locale to ar-AE, Arabic text & resources are correctly displayed in my Activities. However, every time I navigate to an Activity with a WebView and/or a WebViewClient, the locale, text

2021-03-23 06:55:16    分类:问答    android   android-webview   locale   android-7.0-nougat   android-chrome