是否可以在工具栏上阻止滚动TextView?

时间:2019-04-14 21:09:20

标签: android scrollview

我正在用简单的视图编写android应用程序。 我想通过向上滚动使TextView停留在活动的顶部。所以我想隐藏ImageView,但是仍然向下滚动,我的TextView应该保持在顶部。

ScrollView在此代码的内部。

    <ImageView
        android:id="@+id/icon_single"
        android:layout_width="match_parent"
        android:layout_height="250sp"
        android:src="@drawable/icon"
        android:paddingTop="0dp"
        android:paddingBottom="0dp"
        android:cropToPadding="true"
        android:background="@color/colorPrimary"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:layout_gravity="center_vertical"
            android:padding="10sp">
            <TextView
                android:id="@+id/single_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"/>
        </LinearLayout>
   </LinearLayout>

0 个答案:

没有答案
相关问题