如何在Android Studio中显示ViewStub预览?

问题描述 投票:11回答:1

我有一个这样的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中有一个功能请求。但是到目前为止,还没有人研究过它。如果有人有任何解决方法,我仍将保持开放状态。

android android-studio android-studio-3.0 viewstub
1个回答
4
投票

将此添加到ViewStub:

© www.soinside.com 2019 - 2024. All rights reserved.