android - 如何在 ScrollView 中的 ImageButton 上制作静态 TextView?
问题描述
<ImageButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/busfoto2" />
</LinearLayout>
</ScrollView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bus Locations"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
我试过了,但滚动屏幕时文本仍在移动,我想在特定的 ImageButton 上修复它
解决方案
将 Button 和 TextView 放入 FrameLayout 中,如下所示:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/busfoto2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Bus Locations"/></FrameLayout>
推荐阅读
- python - 如何获取序列化方法字段中的所有实例
- angular - Angular:如何传递后端数据,在 ngfor 中单击特定组件
- php - 如何在 WordPress 管理仪表板上的 WooCommerce 选项卡下重命名菜单选项卡
- java - Apache Karaf - 收到致命警报:protocol_version
- c# - C# - Newtonsoft - 解析值时遇到意外字符
- html - 如何在 HTML 中显示数组值
- azure - 如何通过 REST API 更新 Azure App Services 中的容器设置?
- python - drop_sel 不接受切片
- dom - Paypal 按钮第一次不显示
- php - PHP:如何格式化日期时间以将 if/else 用于 CSS