Android学习时遇到的问题之三:百分比布局PercentFrameLayout和PercentRelativeLayout废弃

我在学习《第一行代码 Android》时,书中介绍的百分比布局PercentFrameLayoutPercentRelativeLayout已经废弃,被androidx.percentlayout:percentlayout:1.0.0替代。

开发环境:
macOS 10.16
Android Studio 4.0.1

书中代码如下:
《第一行代码 Android》106页《第一行代码 Android》107页
修正代码:

// app\build.gradle
dependencies {
   
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
    // 插入此行代码
    implementation 'androidx.percentlayout:percentlayout:1.0.0'
    // 
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
<!--src/main/res/layout/activity_main.xml-->
  • 7
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值