android - Android - 在 Imageview 上创建滚动按钮
问题描述
我有一个 ImageView 的活动,它比屏幕大,所以它位于 ScrollLayout 内。
我想在这个 imageView 上创建按钮,但是: - 如果我看不到整个图像,如何将按钮放在图像上?例如,我附加了一个绿色代表 imageView 而红色框代表按钮的图像。如果可滚动,我如何将所有按钮放在图像上?
解决方案
您可以通过使用例如 aFrameLayout
作为ScrollView
. 所以你的 xml 看起来像这样:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button .../>
<Button .../>
<Button .../>
</FrameLayout>
</ScrollView>
推荐阅读
- graph - 在 Janusgraph 中合并 Gremlin 查询
- git - git pre-push hook:在每个新提交上运行测试
- javascript - 将 element.dataset(一个 DOMStringMap 对象)转换为 vanilla JavaScript 中的“真实”JSON 对象?
- objective-c - 仅在 textView 而不是 textField 上移动视图
- javascript - 为什么我不能将变量名传递给 JS 函数?
- python - 使用decimal.Decimal从表达式输出多值?
- php - 更改页面后保持聊天打开
- python - * 在 python 中对 range() 有什么作用?
- python-3.x - Discord bot 不能在 Heroku 上使用 Python 运行
- here-api - HERE 路由 API:未找到卡车路线