这是我的xml代码的精简版,在向下滚动之前,它可以正常工作。向下滚动的问题是“ textline_top”填充了“ NestedScrollView”的角边界。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/top_left_right_radius">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_image"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/textline_top"
android:paddingLeft="30dp"
android:paddingRight="30dp">
<TextView
android:id="@+id/tv_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="some text"/>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
when the app first launched, looks fine
when scrolling down and textline reaches on top, it fills the space of top-left/right corners
我该如何解决这个问题?我希望文本行位于NestedScrollView中。