【问题标题】:Prevent clicked button to cover the foreground view防止单击按钮覆盖前景视图
【发布时间】:2019-07-04 05:48:24
【问题描述】:

我的目标是在右上角创建一个带有图像的按钮。

类似的东西

我点击按钮时遇到的问题,帮助图标被覆盖,看起来很尴尬,我想让它总是在最上面,而点击的按钮仍然有动画点击效果但所有这些都发生在 help 图标下方,相反,我有以下

我的 xml 看起来像

<?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"
    android:orientation="horizontal"
    android:gravity="center">

    <Button
        style="@style/Material.BigButton"
        android:id="@+id/button"
        android:fontFamily="sans-serif-medium"
        android:layout_width="150dp"
        android:layout_height="29dp"
        android:paddingLeft="16dp"
        android:layout_marginTop="30dp"
        android:paddingRight="16dp"
        android:layout_gravity="center_vertical"
        android:text="button"
        android:background="@drawable/rounded_button"/>

    <Button
        style="@style/Material.BigButton"
        android:id="@+id/help"
        android:layout_width="60dp"
        android:layout_height="20dp"
        android:layout_gravity="center"
        android:layout_marginLeft="130dp"
        android:fontFamily="sans-serif-black"
        android:textSize="10dp"
        android:text="help"
        android:textColor="@color/black" />

</RelativeLayout>

花了一天时间寻找类似的问题,唯一的发现是禁用与我的设计不匹配的按钮动画android:stateListAnimator="@null"。我玩过各种属性,比如。

android:elevation=
android:translationZ=

没有什么对我有用。

任何方向都会受到赞赏。

谢谢

【问题讨论】:

    标签: android button layout


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-23
      • 1970-01-01
      • 1970-01-01
      • 2017-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多