Android Studio 布局文件格式化代码
来源:互联网 发布:南京大学软件工程技术 编辑:程序博客网 时间:2024/04/29 23:47
Android Studio 布局文件格式化代码
原本布局文件的代码是下面的样子:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.chenql.changeappicon.MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!"/></RelativeLayout>
现在Android 建议布局文件结束标签要换行,即期望格式如下:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.chenql.changeappicon.MainActivity" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" /></RelativeLayout>
进入Android Studio 设置界面,Editor -> Code Style -> XML -> Android -> Layout Files :勾选”Insert line breaks after last attribute”,即在最后一个属性后插入换行符,最后点击”Apply” 应用修改,这样Layout XML 文件在格式化代码时闭合标签就会在下一行插入了。
写在最后:
对我这种三分钟热度的人来说,坚持写blog 果然任重而道远呀!
早就想知道怎么做这样子格式化代码了,却一直懒!今天才来查看设置怎么做的!
0 0
- Android Studio 布局文件格式化代码
- Android Studio 格式化代码
- android studio 格式化代码
- android studio代码格式化问题
- Android Studio中格式化代码
- Android Studio 如何格式化代码
- Android Studio中格式化代码
- Android Studio中格式化代码
- android studio布局文件/XML怎么代码补全
- Android studio 布局文件变全黑
- Android Studio如何格式化XML代码顺序。
- Android studio 设置代码格式化不换行
- android studio 链式编程代码格式化
- Android Studio 格式化 Format代码快捷键问题
- android studio 格式化代码 自动换行
- Android Studio格式化(Format)代码快捷键
- Android studio 一键格式化所有代码
- Android Studio 自动生成布局代码插件
- Android 快速开发框架————————致力于让Android开发更简单
- eclipse maven打包ssm项目,漏掉mapper.xml文件解决方法
- Android 系列 1.13程序:一个简单的CountDownTimer示例
- Mybatis增删改查实例
- 几种嵌入式实时操作系统的分析与比较
- Android Studio 布局文件格式化代码
- shiro 加密登录
- ViewHolder 工具类实现
- AndroidStudio——Freeline的使用
- SendMessage && PostMessage
- odoo系统中如何导入/导出数据?
- leetcode-389-find the difference
- Vue.js的组件和框架PC与移动 iView elementUI MintUI
- MT6737 Android N 平台 Audio系统学习----录音到播放录音流程分析