android - XML中没有更多建议

标签 android xml android-studio android-layout gradle

我的XML文件中不再有自动填充建议。我不确定我做了什么。我认为它与我的Gradle文件有关系,但无法查明。据我了解,“xmlns:tools =” http://schemas.android.com/tools“是从哪里来的。我认为问题可能出在我使用的是实质性的按钮和应用程序兼容性之类的东西。我也多次同步了Gradle,通常情况下,我可以输入“wi”之类的字样,它会显示一个带有大量建议的下拉菜单。

Gradle :

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"

    defaultConfig {
        applicationId "com.example.firetest"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    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.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    implementation 'com.lorentzos.swipecards:library:1.0.9'
    implementation "androidx.cardview:cardview:1.0.0"
    implementation 'com.google.firebase:firebase-analytics:17.2.2'
    implementation 'com.google.firebase:firebase-database:19.2.1'
    implementation 'com.google.firebase:firebase-auth:19.2.0'
    implementation 'com.google.firebase:firebase-storage:19.1.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    //implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.recyclerview:recyclerview-selection:1.1.0-rc01'
    implementation 'com.google.android.material:material:1.2.0-alpha06'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'


}

XML示例:
<?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:layout_weight="100"
    android:orientation="vertical"
    tools:context=".SignUpProcess.PhotoActivity.Photo_Activity">

    <LinearLayout

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:weightSum="20">

        <TextView
            android:layout_width="204dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="33dp"
            android:layout_marginTop="33dp"
            android:fontFamily="@font/roboto_black"
            android:text="Add your photos here"
            android:textColor="@android:color/holo_green_light"
            android:textSize="32dp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="33dp"
            android:layout_marginTop="3dp"
            android:fontFamily="@font/roboto_black"
            android:text="Please add at least three photos"
            android:textColor="@android:color/black"
            android:textSize="12dp" />

    </LinearLayout>

    <LinearLayout

        android:id="@+id/rl"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal"
        android:orientation="vertical"
        android:weightSum="66"
        tools:context=".SignUpProcess.PhotoActivity.Photo_Activity">

        <androidx.recyclerview.widget.RecyclerView

            android:layout_marginTop="20dp"
            android:id="@+id/recycler_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clipToPadding="false">

        </androidx.recyclerview.widget.RecyclerView>

        <ImageButton
            android:id="@+id/continueBtn"
            android:layout_width="wrap_content"
            android:layout_height="52dp"
            android:layout_gravity="center"
            android:layout_marginBottom="223dp"
            android:background="@null"
            android:scaleType="fitCenter"
            android:src="@drawable/next_btn" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:weightSum="14dp">

    </LinearLayout>

最佳答案

一种可能性是在android studio中检查power mode
转到File > Power mode并检查其开启或关闭。如果启用,您也将不会得到任何建议。

更新:如果对您不起作用,则应重置Android Studio,这将为您设置默认配置。为此,找出.AndroidStudioBeta.AndroidStudio文件夹并删除它们,然后重新启动android studio。通常,您会将这个文件夹放入users\[user name]\

让我知道是否对您有帮助。
祝您编码愉快!

关于android - XML中没有更多建议,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62054860/

相关文章:

android - 在 Android Studio 中开发同一个应用的两个版本

android - 如何在同一 View 中运行不同的 Activity

java - 如何获取视频文件详细信息,例如。安卓的持续时间?

java - 如何为单选按钮分配一个值并稍后在 Android 中检索该值?

java - 如何在调试应用程序时检查当前正在运行哪个 Activity

java - 如何让Android studio内嵌JDK使用本地文档路径

用于本地库的 Android Gradle 3.0 和 "Unresolved reference R"

android - 在具有大量文本行和样式的 EditText 中启用 2D 滚动

C# LINQ Xml查询混淆

sql-server - 将文本安全转换为 XML