美文网首页
在 ConstraintLayout 中使用 ViewStub

在 ConstraintLayout 中使用 ViewStub

作者: sunrain_ | 来源:发表于2019-06-16 20:52 被阅读0次

在 ViewStub 中,设置 inflatedId 与 id 相同:

<ViewStub
    android:id="@+id/viewStub_ad"
    android:inflatedId="@+id/viewStub_ad"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout="@layout/view_stub_maps_bottom_ad"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/map" />

相关文章

网友评论

      本文标题:在 ConstraintLayout 中使用 ViewStub

      本文链接:https://www.haomeiwen.com/subject/hkcnfctx.html