【问题标题】:How to clip the bounds of scrollview in Xamarin Android如何在 Xamarin Android 中剪辑滚动视图的边界
【发布时间】:2019-01-02 15:54:33
【问题描述】:

我在滚动视图内的线性布局内有一个图像视图。我无法让 ScrollView 在图像上方和下方停止滚动。我不希望用户能够滚动超出图像的边界。 这是我的 XML:

<ScrollView
        android:id="@+id/scrollViewLegend"
        android:layout_width="wrap_content"
        android:layout_height="200dp"
        android:background="@color/Copper"
        android:scrollbars="vertical"
        android:layout_marginTop="2dp"
        >
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:src="@drawable/legend"
            android:scaleType="fitStart"/>
        </LinearLayout>
    </ScrollView>

任何帮助将不胜感激。 谢谢。

【问题讨论】:

    标签: c# android xml xamarin android-scrollview


    【解决方案1】:

    如果是选项,将 ImageView 的布局高度设置为固定值将解决此问题。

    <ImageView
        android:layout_width="400dp"
        android:layout_height="400dp"
        android:src="@drawable/legend"
        android:scaleType="fitStart"/>
    

    【讨论】:

      猜你喜欢
      • 2018-07-08
      • 2017-10-02
      • 1970-01-01
      • 1970-01-01
      • 2020-11-01
      • 1970-01-01
      • 2011-07-31
      • 2012-04-18
      • 1970-01-01
      相关资源
      最近更新 更多