<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上
答案 0 :(得分:1)
像这样将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>