gpt4 book ai didi

Android Button自动命令到前面

转载 作者:可可西里 更新时间:2023-10-31 22:03:59 24 4
gpt4 key购买 nike

我身上发生了一些奇怪的事情。我有这样的布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray_dark" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawableTop="@drawable/some_drawable"
android:text="Some text" />
</RelativeLayout>

我希望 TextView 在按钮上方可见。但由于某种原因,按钮自动转到前面,覆盖了 TextView 。当我将 Button 更改为普通 View 时,顺序是正确的。

关于 Android 中的按钮,我是否遗漏了什么?谢谢

编辑:

预览:

enter image description here

最佳答案

我刚刚尝试了同样的事情,奇怪的是,它也发生在我身上。我是这样修的

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FF0000"
android:text="lalala"/>

</LinearLayout>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#FFFF00"
android:text="lalala"/>

</RelativeLayout>

关于Android Button自动命令到前面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30397957/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com