有一天,我启动了具有Android Studio功能的基本版面设计程序,但是一旦完成设置,“ Hello World!”我拖放的调色板中的文本和其他项目未显示在设计和蓝图中。我使这些项目可见,甚至更改了程序的设置和代码,但无济于事。
I added a text and buttons from the palette, but the items didn't appear as shown in the image.
以下是Gradle脚本中的一些代码:
注意:我在代码中更改了项目名称。
注意:我正在程序中使用功能。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.test.test.app"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation project(':Test_Feature')
implementation project(':base')
}
apply plugin: 'com.android.feature'
android {
compileSdkVersion 28
baseFeature true
defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
api 'com.android.support:appcompat-v7:28.0.0-rc02'
api 'com.android.support.constraint:constraint-layout:1.1.3'
application project(':app')
feature project(':Test_Feature')
}
apply plugin: 'com.android.instantapp'
dependencies {
implementation project(':Test_Feature')
implementation project(':base')
}
apply plugin: 'com.android.feature'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':base')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
include ':Test_Feature', ':app', ':base', ':instantapp'
答案 0 :(得分:0)
您可能应该做所有这一切:
Restart Android Studio
Rebuild Solution
Make sure you Target an insert point
答案 1 :(得分:0)
检查用于预览的AppTheme是否与在res-> values-> styles.xml中定义的相同。
有时主题不匹配时,在预览屏幕上显示内容会出现问题。
答案 2 :(得分:0)
当您从其他项目复制样式时,有时会发生这种情况。您可以清理并重建可在工具栏中的“构建”下找到的项目