色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術(shù)文章
文章詳情頁

Android Studio 3.5格式化布局代碼時(shí)錯位、錯亂bug的解決

瀏覽:139日期:2022-09-26 14:30:58

更新到3.5版本后,格式化布局文件代碼,會自動給排序元素,導(dǎo)致界面布局錯亂

解決辦法:

設(shè)置 > code style > XML 右上角 Set from然后選擇Predefined Style...>Android即可

Android Studio 3.5格式化布局代碼時(shí)錯位、錯亂bug的解決

補(bǔ)充知識:Android Studio:Reformat Code格式化Xml布局代碼后控件順序錯亂

Android Studio升級3.5之后,遇到個(gè)奇葩問題,在布局xml文件中格式化代碼后,控件的順序都變了,這不是我們想要的結(jié)果,網(wǎng)上搜了一下,確實(shí)是AS3.5的鍋,每次升級都會遇到不同的問題,先記錄一下吧,以后有時(shí)間再研究為什么做的調(diào)整。

<?xml version='1.0' encoding='utf-8'?><LinearLayout xmlns:android='http://schemas.android.com/apk/res/android' xmlns:tools='http://schemas.android.com/tools' android:layout_width='match_parent' android:layout_height='match_parent' android:orientation='vertical' android:padding='16dp' tools:context='sun.geoffery.mvpdemo.MainActivity'> <TextView android: android:layout_width='match_parent' android:layout_height='0dp' android:layout_weight='1' android:text='點(diǎn)擊按鈕獲取網(wǎng)絡(luò)數(shù)據(jù)' /> <Button android: android:layout_width='match_parent' android:layout_height='wrap_content' android:text='獲取數(shù)據(jù)【成功】' /> <Button android: android:layout_width='match_parent' android:layout_height='wrap_content' android:text='獲取數(shù)據(jù)【失敗】' /> <Button android: android:layout_width='match_parent' android:layout_height='wrap_content' android:text='獲取數(shù)據(jù)【異常】' /></LinearLayout>

這個(gè)簡單的布局界面大致如下圖所示:

Android Studio 3.5格式化布局代碼時(shí)錯位、錯亂bug的解決

走你,Ctrl+Shift+F,格式化一把,再看我們的代碼:

<?xml version='1.0' encoding='utf-8'?><LinearLayout xmlns:android='http://schemas.android.com/apk/res/android' xmlns:tools='http://schemas.android.com/tools' android:layout_width='match_parent' android:layout_height='match_parent' android:orientation='vertical' android:padding='16dp' tools:context='sun.geoffery.mvpdemo.MainActivity'> <Button android: android:layout_width='match_parent' android:layout_height='wrap_content' android:text='獲取數(shù)據(jù)【成功】' /> <Button android: android:layout_width='match_parent' android:layout_height='wrap_content' android:text='獲取數(shù)據(jù)【失敗】' /> <Button android: android:layout_width='match_parent' android:layout_height='wrap_content' android:text='獲取數(shù)據(jù)【異常】' /> <TextView android: android:layout_width='match_parent' android:layout_height='0dp' android:layout_weight='1' android:text='點(diǎn)擊按鈕獲取網(wǎng)絡(luò)數(shù)據(jù)' /></LinearLayout>

原本最頂部的TextView被格式化到了最下面,一臉懵逼,界面如下:

Android Studio 3.5格式化布局代碼時(shí)錯位、錯亂bug的解決

具體解決方法如下:

Settings?>Editor?> Code Style?>XML

點(diǎn)擊右上角的Set from->Predefined Style選擇Android后點(diǎn)擊OK保存,Perfect!

Android Studio 3.5格式化布局代碼時(shí)錯位、錯亂bug的解決

再格式化代碼,就是我們想要的效果了

Android Studio 3.5格式化布局代碼時(shí)錯位、錯亂bug的解決

以上這篇Android Studio 3.5格式化布局代碼時(shí)錯位、錯亂bug的解決就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Android
相關(guān)文章:
主站蜘蛛池模板: fc2在线播放 | 手机看片神马午夜 | 日韩精品视频美在线精品视频 | 国产伦精品一区二区三区无广告 | 久久一本综合 | 成人性色生活片免费网 | 经典国产乱子伦精品视频 | 日韩视频一区二区三区 | 国产亚洲一区在线 | 日本理论在线 | 日本特黄a级高清免费酷网 日本特黄特色 | 亚洲欧美国产精品 | 国产精品日韩一区二区三区 | 7m视频精品凹凸在线播放 | 亚洲第一色网 | 国产特黄一级一片免费 | 亚洲一区欧美二区 | 国产一级aaa全黄毛片 | 日韩精品亚洲人成在线观看 | 国产妇乱子伦视频免费 | 在线精品自拍 | 特级一级毛片视频免费观看 | 可以看的毛片网站 | 欧美成人看片黄a免费 | 99re热久久| 日韩一品在线播放视频一品免费 | 欧美做爰性欧美 | 成人性视频在线 | 日韩精品免费一区二区三区 | 不卡午夜视频 | 中国精品视频一区二区三区 | 国产一级一片免费播放刺激 | 高清一区二区在线观看 | 日韩欧美色综合 | 国产精品久久久99 | 九九这里只精品视在线99 | 一区二区三区在线 | 网站 | 最新亚洲精品国自产在线 | 曰韩毛片 | 日韩精品特黄毛片免费看 | 午夜久久网|