当前位置:   article > 正文

12.15 写Android UI组件遇到问题_this item's height is 19dp. consider making the he

this item's height is 19dp. consider making the height of this touch target

1.imeOptions :android键盘中的enter键图标是可以用EditText的android:imeOptions标签变更

android:ems = "10" : 设置TextView或者Edittext编辑的字符串长度为10,超出部分不显示,该属性只有android:layout_width=“wrap_content” 时才显示,是march_parent时不会有变化

android:layout_alignParentBottom="true"

2.遇到问题:

1)android:id="@id/bottomLine_1”报错Cannot resolve symbol '@id/bottomLine_1' 原因:id前少+

2)’B’ is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore报错  原因:文件名称不能有大写B

3)Execution failed for task ':app:processDebugResources'.

> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction

   > Android resource linking failed

     ERROR:/Users/Hannah/Desktop/Android/KTNews/app/src/main/res/layout/login.xml:30: AAPT: error: attribute android:textsize not found.

原因:大小写拼写问题

4)Execution failed for task ':app:mergeDebugResources'.

> A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable

   > Resource compilation failed. Check logs for details.

ParseError at [row,col]:[17,53]

Message: http://www.w3.org/TR/1999/REC-xml-names-19990114#AttributePrefixUnbound?TextView&app:layout_constraintBottom_toTopOf&app原因:fragment_first.xml里面的 <androidx.constraintlayout.widget.ConstraintLayout里面 xmlns:app="http://schemas.android.com/apk/res-auto"  这句去掉就会布局完全错乱报错Namespace’app’ is not bound

5)安卓的xml文件名不能含大写字母?java或Kotlin类文件名和属性名和对应的xml文件名和文件内控件id有关联,比如login.xml里面的xmlns:tools="http://schemas.android.com/tools"

tools:context=".FirstFragment”那么FirstFragment.java文件内的import com.example.ktnews.databinding.LoginBinding此处必须为Login 否则会报错

6)run安装报错:Installation did not succeed.

The application could not be installed.

List of apks:

[0] '/Users/Hannah/Desktop/Android/KTNews/app/build/outputs/apk/debug/app-debug.apk'

Installation failed due to: ''cmd package install-create -r -t --user current --full --dont-kill --skip-verification -S 3216623' returns error 'Unknown failure: cmd: Can't find service: package''

看到进程qemu-system-aarch64 占cpu300%多 清理进程,wipe Data模拟器后重新运行解决

7)Touch size is too small This item's height is 25dp. Consider making the height of this touch target 48dp or larger.  suggestion不是错误可以ignore

8)只有Button的background颜色设置成自定义的xml无效,而是受themes影响,而自定义xml里的corner有效 目前没解决 应该怎么解决或别的替换方式?

解决办法:找到res/values目录下的themes.xml将里面的

<style name="Theme.UICustomViews" parent="Theme.MaterialComponents.DayNight.DarkActionBar">改成

<style name="Theme.UICustomViews" parent="Theme.MaterialComponents.DayNight.DarkActionBar.Bridge">

3.疑问:

1.Android 布局巧用之include、merge、ViewStub 2.baselineAligned这是干啥的呢?设置成true或false都没用

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/219493
推荐阅读
相关标签
  

闽ICP备14008679号