热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

未在xml中检测到TextViewautoSizeTextType-TextViewautoSizeTextTypeisnotdetectinginxml

ImlookingforchangingtheTextViewSizesautomatically.AndIfoundthesolutionaswell.Hereis

I'm looking for changing the TextView Sizes automatically. And I found the solution as well. Here is the official Doc for Auto sizing textviews. But Still I'm not able to resolve it. When i paste autoSizeTextType its showing error in xml file.

我正在寻找自动更改TextView大小。我也找到了解决方案。以下是自动调整文本视图的官方文档。但我还是无法解决它。当我将autoSizeTextType粘贴到xml文件中时显示错误。

Here is the my xml code and gradle code snippets

这是我的xml代码和gradle代码片段

myactivity.xml










Gradle snippet

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:support-v4:25.2.0'//Added support library
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    testCompile 'junit:junit:4.12'
}

3 个解决方案

#1


2  

As stated in the docs:

如文档中所述:

The Support Library 26.0 provides full support to the autosizing TextView feature on devices running Android versions prior to Android 8.0 (API level 26). The library provides support to Android 4.0 (API level 14) and higher. The android.support.v4.widget package contains the TextViewCompat class to access features in a backward-compatible fashion.

支持库26.0完全支持在Android 8.0(API级别26)之前运行Android版本的设备上自动调整TextView功能。该库提供对Android 4.0(API级别14)及更高版本的支持。 android.support.v4.widget包中包含TextViewCompat类,以向后兼容的方式访问功能。

You need to replace TextView with AppCompatTextView and upgrade your support lib to v26.0.0 in order to use that feature.

您需要将TextView替换为AppCompatTextView,并将支持lib升级到v26.0.0才能使用该功能。

compile 'com.android.support:support-v4:26.0.0'

Don't forget to upgrade your buildToolsVersion to 26.0.0 and compileSdkVersion to 26 as well.

不要忘记将buildToolsVersion升级到26.0.0并将compileSdkVersion升级到26。

#2


6  

Use AppCompatTextView and supportLibrary 26.0.1

使用AppCompatTextView和supportLibrary 26.0.1




    


#3


-5  

This API is available only from API level 26.

此API仅适用于API级别26。


推荐阅读
author-avatar
冬季梅花1991_156
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有