简体   繁体   中英

When press the button, it will be brought to front of another button

Hi I have to buttons like the following:

XML

<RelativeLayout
        android:id="@+id/total_price_detailed"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/total_amount_price"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="7dp">

        <com.arosis.pos.aropay.customization.ButtonIranSansFont
            android:id="@+id/total_amount_proforma_invoice"
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="15dp"
            android:background="@drawable/circular_button"
            android:paddingEnd="15dp"
            android:paddingRight="15dp"
            android:text="جزئیات خرید"
            android:textAlignment="viewEnd"
            android:textColor="@color/white_in_dark_background"
            android:textSize="18sp" />

        <com.arosis.pos.aropay.customization.ButtonRezvanFont
            android:id="@+id/total_price_counter"
            android:layout_width="wrap_content"
            android:layout_height="30dp"
            android:layout_alignParentStart="true"
            android:layout_alignTop="@+id/total_amount_proforma_invoice"
            android:layout_margin="9dp"
            android:layout_marginStart="30dp"
            android:background="@drawable/circular_white_button"
            android:gravity="top"
            android:maxLength="10"
            android:minWidth="30dp"
            android:paddingEnd="3dp"
            android:paddingLeft="3dp"
            android:paddingRight="3dp"
            android:paddingStart="3dp"
            android:text="0"
            android:textAlignment="center"
            android:textColor="@color/black_overlay"
            android:textSize="18sp"
            android:textStyle="bold" />
    </RelativeLayout>

when I hold click to total_amount_proforma_invoice in a ripple mode, it will be brought to in front of another button and when I release it, it will be OK, I don't want to have this and I always want to have total_amount_proforma_invoice back to total_price_counter . What should I do? Thanks in advance.

Check this:

Update:

Only add: android:stateListAnimator="@null" in @+id/total_amount_proforma_invoice View.

Example:

<com.arosis.pos.aropay.customization.ButtonIranSansFont
            android:id="@+id/total_amount_proforma_invoice"
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="15dp"
            android:background="@drawable/circular_button"
            android:paddingEnd="15dp"
            android:paddingRight="15dp"
            android:stateListAnimator="@null"
            android:text="جزئیات خرید"
            android:textAlignment="viewEnd"
            android:textColor="@color/white_in_dark_background"
            android:textSize="18sp" />

Works Fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM