问题
I am currently going through a ConstraintLayout tutorial and stuck in a specific step (https://codelabs.developers.google.com/codelabs/constraint-layout/#10).
The source is here (https://github.com/googlecodelabs/constraint-layout).
Per instructions below, it says to add a vertical barrier but I do not see the add option in the menu. Actually the entire menu options look different. Where is the "Add Vertical barrier" menu?
Right click on ConstraintLayout in the blueprint or the Component Tree. You will see the Add Vertical barrier and Add Horizontal barrier options.
I am running Android 2.3.3.
build.gradle (Module: app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.google.googleio"
minSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support.constraint:constraint-layout:1.1.0-beta1'
}
回答1:
I am running Android 2.3.3.
I am going to guess that you mean that you are running Android Studio 2.3.3. In that case, there is no such menu. That is added in Android Studio 3.0, available in beta from today.
回答2:
Add this line to your gradle (Module:app)
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta1'
来源:https://stackoverflow.com/questions/46028235/add-constraint-layout-barriers-missing-in-context-menu-of-android-android-studio