资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

AttributexxisonlyusedinAPIlevelxxandhigher(currentminis xx)的解决方法

错误:Attribute "" is only used in API level 21 and higher (current min is   10)

创新互联公司长期为近千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为鄞州企业提供专业的网站制作、网站建设鄞州网站改版等技术服务。拥有十年丰富建站经验和众多成功案例,为您定制开发。

问题重现:

    

1、在xml布局中碰到这样的问题是由于  配置了最低兼容Api。

    例如在AndroidManifest中配置:

    

        android:minSdkVersion="10"

        android:targetSdkVersion="21" />

2、兼容到Api 10 也就是2.3.3的系统。

3、此时在布局中使用了Api21的 属性 :android:transitionName="y"

    

            android:id="@+id/titleLayout"

           android:transitionName="y"

           android:layout_width="match_parent"

           android:layout_height="45dp"

           android:background="@color/redColor" >

4、就会警告:Attribute "transitionName" is only used in API level 21 and higher (current min is 

 10)

5、解决方法如下根据属性的版本新建一个values-xx,根据上述例子,我们需要新建一个values-v21的文件

在里面新建一个styles.xml

Attribute xx is only used in API level xx and higher (current min is   xx)的解决方法

6、在代码中引入该style

    

           android:id="@+id/titleLayout"

           

           android:layout_width="match_parent"

           android:layout_height="45dp"            

           android:background="@color/redColor">

大功告成,values-v21是对资源进行版本适配


文章标题:AttributexxisonlyusedinAPIlevelxxandhigher(currentminis xx)的解决方法
网页路径:http://cdkjz.cn/article/pcgjep.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220