在 ConstraintLayout 中使用 ViewStub

2019-06-16  本文已影响0人  sunrain_

在 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" />
上一篇 下一篇

猜你喜欢

热点阅读