0
        <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 上修复它

4

1 回答 1

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>
于 2019-03-01T13:51:30.853 回答