From 8a03e089b12e2694ec45b25e733ae18c9548cda9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=BA=86=E6=B3=89?= Date: Tue, 30 Aug 2022 08:43:16 +0000 Subject: [PATCH] update docs/plugin/UTSForAndroid.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 杜庆泉 --- docs/plugin/UTSForAndroid.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/plugin/UTSForAndroid.md b/docs/plugin/UTSForAndroid.md index d9907bbdb..12918690f 100644 --- a/docs/plugin/UTSForAndroid.md +++ b/docs/plugin/UTSForAndroid.md @@ -109,4 +109,22 @@ getResourcePath("uni_modules/test-uts-static/static/logo.png") 容器的宿主activity 回退物理按键点击时触发 -## 4 注意事项 \ No newline at end of file +## 4 常见问题 + + +### Float类型传参 + +android很多布局参数强制要求Float,但是ts中没有内置这种类型。可以使用下面的代码实现转换 + +``` +var textSize = 30.0.toFloat(); +``` + +### 泛型参数 + +android中UI相关的api,很多都要去泛型,目前UTS支持用as关键字强转,满足类似的场景 + +``` +var frameContent = decorView.findViewById(android.R.id.content) as FrameLayout +``` + -- GitLab