博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
《第一行代码》读书笔记(一)
阅读量:4170 次
发布时间:2019-05-26

本文共 765 字,大约阅读时间需要 2 分钟。

3.6节 recyclerView 添加依赖

书中在build.gradle文件内使用的是compile命令,现在不再支持,将命令改为implementation,如下:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'com.android.support:recyclerview-v7:24.2.1' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'}

相应地,在xml文件中引用recyclerView控件时,使用androidx库,标签如下:

4.4节 动态加载布局

这里需要添加一个layout-large/activity_main.xml,不过操作的时候会报错:重复文件名(尽管这个与默认的activity_main.xml不在同一个路径下),这似乎是AS新增的功能,如下图:

在这里插入图片描述
解决方法:
右键layout-large–>New–>layoutsoursefile即可(最后一步不要点那个xml),如下图:
在这里插入图片描述

转载地址:http://huwai.baihongyu.com/

你可能感兴趣的文章
pthread线程使用小结
查看>>
A Game of Thrones(59)
查看>>
2018.3.19
查看>>
A Game of Thrones(97)
查看>>
A Game of Thrones(98)
查看>>
2018.3.20
查看>>
2018.3.21
查看>>
2018.3.22
查看>>
2018.3.23
查看>>
A Game of Thrones(102)
查看>>
2018.4.29
查看>>
2018.4.30
查看>>
2018.4.31
查看>>
2018.4.32
查看>>
2018.4.33
查看>>
《python基础教程》答案(第一章)
查看>>
2018.4.34
查看>>
2018.4.35
查看>>
2018.4.36
查看>>
我为什么要写博客
查看>>