先上效果
文章图片
实现流程:
- 按钮登录的点击事件:移动各个组件到中心
- 请求网络,登录验证
- 验证通过后,button设置文字“登录成功”,跳转到其他activity,未通过则各个组件返回原位置
恰好不怎么忙就好好学习一下。
总结 ConstraintLayout很强,对于不同机型的适配很好用(百分比布局-不用写marginLeft,marginTop之类的);
- Circular positioning
- 百分比布局
- GuideLine
- Chains
- Group
- Barrier
推荐阅读
- android-studio|Android 下载apk提示更新以及解决Android 6.0 Marshmallow提示更新报错问题
- android-studio|Android 修改包名无法运行activity class does not exist