对约束布局进行编码:
<View
android:id="@+id/divider"
style="@style/divider_style"
android:layout_width="0dp"
swedbank:layout_constraintBottom_toBottomOf="parent"
swedbank:layout_constraintLeft_toLeftOf="parent" />
<ImageView
android:id="@+id/some_image"
style="@style/some_style"
swedbank:layout_constraintBottom_toBottomOf="@+id/divider" <!-- This '+' -->
swedbank:layout_constraintRight_toRightOf="parent"
swedbank:layout_constraintTop_toTopOf="@+id/divider" /> <!-- This '+' -->查看注释:这些行上的加号必须在那里,android studio布局渲染器才能工作。如果没有它们,你会得到:
Couldn't resolve resource @id/divider Tip: Try to refresh the layout.我一直以为@+id/是你第一次定义一个id?
几年前,如果我到处使用+,我就遇到了IDE问题:使用goto定义,IDE将不知道要转到哪个id
在Android studio 2.3.3和3.0.1上测试
既然自动补全给了你到处都是的加号,我是不是应该随心所欲呢?
发布于 2018-02-06 21:32:34
尝试将此代码添加到gradle compile 'com.android.support.constraint:constraint-layout:1.0.2'中的依赖项部分
https://stackoverflow.com/questions/48643870
复制相似问题