首页 > 编程知识 正文

Android 快速将约束布局转为线性布局,android约束布局

时间:2023-05-03 12:39:03 阅读:208834 作者:2685

只论快速将约束布局转为线性布局,不修改默认布局

创建一个新活动,默认为约束布局

<?xml version="1.0" encoding="utf-8"?><androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".TestActivity"></androidx.constraintlayout.widget.ConstraintLayout>

快速转为线性布局,直接修改xmlns:android="http://schemas.android.com/apk/res/android"前约束布局组件为线性布局即可:

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".TestActivity"></LinearLayout>

修改为其他布局同理。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。