我有一个ViewStub,形如 -
<android.support.constraint.ConstraintLayout>
<ViewStub
android:id="@+id/photos"
android:layout="@layout/add_photos"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/details"
tools:visibility="visible" />
...
</android.support.constraint.ConstraintLayout>
但是ViewStub在布局预览和设计选项卡中不会呈现。使用<include/>
可以正常工作。
我正在使用Android Studio 3.0 Beta 6。
在使用ViewStub时有没有一种方法可以呈现预览?
编辑:
看起来在Google问题跟踪器中有一个功能请求https://issuetracker.google.com/issues/37090997,但目前没有人关注它。如果有人有任何解决方法,我仍将保持问题开放。