Skip to content

ConstraintLayout 问题 #30

Description

@asker517
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:layout_width="match_parent"android:layout_height="match_parent"
>
<FrameLayoutandroid:id="@+id/layoutTest"android:layout_width="match_parent"android:layout_height="0dp"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"
>
<TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:text="show content"android:textColor="@color/cardview_dark_background"
/>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

如上指定显示state区域contentView 为layoutTest,如果android:layout_height="0dp"调用showContentView(),实际内容并不能被正确显示出来,此时最终的layoutTest...height就为0了...
@DylanCaiCoding

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions