Android小部件没有显示其属性建议我什么时候写

问题描述 投票:3回答:1

当我尝试编写其属性时,Android Weight没有显示其属性。但是如果写的话就有效。现在我想在写作时看一个建议。我怎么解决这个问题?检查图像以获得更清晰。

enter image description here

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent">


<TextView
    android:id="@+id/textView2"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:padding="10dp"
    android:text="TextView"
    android:textColor="#000"
    android:textSize="30sp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />
 </androidx.constraintlayout.widget.ConstraintLayout> 

[更新]我还添加我的app / build.gradle文件我重启我的android工作室,但我面临同样的问题。我创建了一个问题所在的新项目。

我的app / build.gradle

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 28
        defaultConfig {
          applicationId "com.rocketechit.officemanagementapp"
          minSdkVersion 16
          targetSdkVersion 28
         versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
    implementation 'com.google.android.material:material:1.0.0-beta01'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'

    //Butter knife
    implementation 'com.jakewharton:butterknife:10.0.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'

    //firebase
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'

    //picasso
    implementation 'com.squareup.picasso:picasso:2.71828'
    //circle image view
    implementation 'de.hdodenhof:circleimageview:3.0.0'
//custom calender
    implementation 'sun.bob:mcalendarview:1.0.0'

    //scanner

    implementation 'com.google.zxing:core:3.2.1'
    implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'

}
apply plugin: 'com.google.gms.google-services'
android xml android-studio android-layout android-layout-weight
1个回答
1
投票
File -> Invalidate Caches / Restart... -> Select Invalidate and Restart

尝试上面的代码,它将清理android studio中的所有缓存。希望它会起作用:)

编辑

从项目中删除.idea文件夹和所有.iml文件,然后重新启动Android Studio,重建gradle将在这种情况下工作。并且在删除后不要忘记使高速缓存/重新启动失效

如果上述情况仍不适合您,则需要从android studio中删除系统文件

yourPathToDrive:/ AndroidStudio3.3 /系统

© www.soinside.com 2019 - 2024. All rights reserved.