更改<include layout =“”

时间:2018-11-20 15:18:54

标签: android android-layout android-tablayout android-constraintlayout

=“”

我有一个现有的<include layout,需要更改此参数中的两个参数以编程方式进行布局以将其设置在TableLayout中 一次必须执行:

 android:layout_height="0dp"
 app:layout_constraintBottom_toBottomOf="parent"

再来一次

 android:layout_height="wrap_content"

这是布局

<include
    android:id="@+id/search_results_cv"
    layout="@layout/addresses_card_view"
    android:layout_width="0dp"// or wrap
    android:layout_margin="8dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/my_location_cv"
    app:layout_constraintBottom_toBottomOf="parent"//one time want t call another time not
/>

我不需要像here那样的ViewStub,因为不需要更改include中指示的布局,但是include中的参数就可以了!

编辑:

这是新的包含布局:

    <include
        android:id="@+id/search_results_cv"
        layout="@layout/addresses_card_view"

        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/my_location_cv"
 />

0 个答案:

没有答案