c# - 如何在 Xamarin Android 中剪辑滚动视图的边界
问题描述
我在滚动视图内部的线性布局中有一个图像视图。我无法让 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>
任何帮助,将不胜感激。谢谢。
解决方案
如果它是一个选项,将 ImageView 的布局高度设置为固定值将解决此问题。
<ImageView
android:layout_width="400dp"
android:layout_height="400dp"
android:src="@drawable/legend"
android:scaleType="fitStart"/>
推荐阅读
- c# - Azure WebJobs SDK TimerTrigger 函数未运行
- python - 执行合并后在数据框中创建新列
- ocaml - 沙丘中 package.opam 文件的目的是什么?
- python - 如何摆脱 Python 中的 BeautifulSoup 错误
- android-studio - 片段的嵌套滚动视图
- javascript - Wordpress 如何使用简码从 localStorage 获取值
- mysql - 有没有办法找到mysql中所有列的唯一值计数和空百分比?
- html - 更改分辨率时,如何使我的段落不会一直向下移动?
- python - 如果仍然循环直到直到
- firebase - Firebase 云函数响应正文限制 - 具有大数据报告端点的无服务器 API 不是一个选项吗?