使用动画调整其子级大小后,滚动视图不会滚动



我在滚动浏览中具有线性延迟。在某个时候,我崩溃并扩展了线层。之后,ScrollView确实滚动。有什么想法吗?

<ScrollView
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fillViewport="false">
    <LinearLayout
        android:id="@+id/detailsView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:visibility="visible"
        >
........
</LinearLayout>
</ScrollView>

使用Linearlayout的LayoutParams(高度)上的calianimator进行了扩展和崩溃。

更新:我认为重要的是它在动画扩展/崩溃后会崩溃。直到它效果很好。

更新2:用于再次扩展,我测量了预期的高度:

  int expectedHeight = detailsView.measure(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

和动画扩展到该高度。这测量了2000 的高度,而不是预期的800个。因此,尺寸是平等的,滚动浏览没有滚动,尽管它没有显示完整的层次结构。

作为快速固定,我在崩溃之前保存当前高度,并将其用作扩展的目标高度。问题是,可以自动完成此操作,而无需节省肮脏的高度?

您的scrollview是 android:layout_height="wrap_content",只需使其成为 match_parent。我不确定,但是您也可以删除android:fillViewport

<ScrollView
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <LinearLayout
        android:id="@+id/detailsView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:visibility="visible"
        >
........
</LinearLayout>
</ScrollView>