国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術(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)文章:
主站蜘蛛池模板: 国产视频自拍一区 | 成人免费福利网站在线看 | 亚洲一区毛片 | 中国女人毛茸茸免费视频 | 日韩欧美成人乱码一在线 | 国产一区二区影院 | 国产97公开成人免费视频 | 精品久久中文网址 | 欧美成人毛片一级在线 | 久草手机视频在线 | 国产高清一级毛片在线不卡 | 日韩美视频网站 | 美国三级毛片 | 爽爽日本在线视频免费 | 欧美a在线| 国产在线一区二区 | 成年人黄视频在线观看 | 精品久久久久久中文字幕一区 | 国产青草| 一区二区亚洲精品 | 免费在线观看a级毛片 | 99久久精品国产一区二区三区 | 精品一区二区影院在线 | 国产精品国产三级国产专播 | 久久久久久综合对白国产 | 男人天堂网在线 | 欧美精品99久久久久久人 | 波多野结衣在线观看一区二区 | 日韩久久一级毛片 | 男人的天堂久久爱 | 日韩国产在线播放 | 日韩永久在线观看免费视频 | 久久综合综合久久 | 欧美午夜在线播放 | 国产原创一区二区 | 国产成年人 | 毛片韩国 | 久久99精品一级毛片 | 中文在线三级中文字幕 | 九九午夜 | 99久久精品免费国产一区二区三区 |