android - XML 中没有更多建议
问题描述
我的 XML 文件中不再收到自动填充建议。我不确定我做了什么。我认为这与我的 Gradle 文件有关,但无法查明。据我了解,“ xmlns:tools="http://schemas.android.com/tools ”是它的来源。我认为问题可能是我正在使用材料按钮和应用程序兼容或类似的东西。我也多次重新同步 Gradle。通常,我可以输入“wi”之类的内容,它会显示一个包含大量建议的下拉菜单。有人能发现问题吗?
摇篮:
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>
解决方案
一种可能性是检查power mode
android studio。转到File > Power mode
并检查其打开或关闭。如果它打开,您也不会得到任何建议。
更新:如果它不适合您,那么您应该重置您的 Android 工作室,这将为您设置默认配置。为此,找出.AndroidStudioBeta
或.AndroidStudio
文件夹并删除它们并重新启动android studio。通常,您会将这个文件夹放入users\[user name]\
.
让我知道它是否对您有帮助。快乐编码..!