关于android studio布局文件中不能自动补齐属性的解决方法

关于android studio布局文件中不能自动补齐属性的解决方法

问题:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
 
    <TextView />
 
</LinearLayout>

创建一个新的TextView控件的时候发现不会自动生成各种属性了,像id,width,height这些属性都没了,几种解决方法如下:

1.Module的iml文件缺少有关SDK属性的一段代码,删了重新build一下(无效)

2.关闭省电模式,File->Power Save Mode,但是我一直没开(无效)

3.没有设置buildToolsVersion,我设置之后还是没用(无效)

4.将目前正在使用的SDK卸载之后再重新安装,然后重启studio(成功)

File->setting->Android SDK->勾去最新版SDK->Apply;
勾选最新版SDK->Apply
如图:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_36158551/article/details/107729949