Android 小部件不显示它的属性我要写时的建议

标签 android xml android-studio android-layout android-layout-weight

当我尝试写入其属性时,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 工作室,但我遇到了同样的问题。我创建了一个新项目,问题就在那里。

我的应用程序/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'

最佳答案

File -> Invalidate Caches / Restart... -> Select Invalidate and Restart

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

编辑

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

如果上述情况仍然不适合你那么你需要从android studio中删除系统文件

yourPathToDrive:/.AndroidStudio3.3/system

关于Android 小部件不显示它的属性我要写时的建议,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55040005/

相关文章:

android - 在线性布局中对齐 ImageView 和 TextView

java - 我可以自定义 Android searchable.xml 布局吗?

Android Studio 缺少 src 文件夹

java - 运行 Flutter 应用时出现 "Could not connect to the Gradle daemon"和 IP 地址问题

java - 我的 Android 应用程序总是停止;是因为我因找不到证书文件而收到 GPRC 错误吗?

android - ViewPagerIndicator 库配置

android - 无法解析 Artifact/缺失 Artifact (Eclipse)

php - 为什么 JSON 返回 null?

xml - XML 阅读器是否应该忽略 XML 文件中的连续空格?

xml - Eclipse:将 "dxml"文件视为 "xml"文件?