【问题标题】:How to make a static TextView over the ImageButton in ScrollView?如何在 ScrollView 中的 ImageButton 上制作静态 TextView?
【发布时间】:2019-03-01 13:46:02
【问题描述】:
        <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 上修复它

【问题讨论】:

  • 你能发布你的布局吗?

标签: android xml textview scrollview imagebutton


【解决方案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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多