按钮比例动画使背景剪辑

时间:2018-08-05 06:57:57

标签: android button objectanimator

按下按钮时,我正在缩放按钮。但是当我缩放它时,背景会被剪切。这些是照片

This is normal button without click

This is when the button is clicked

这是按钮xml代码:

method: pam none
clientmethod: none
user.privileged: root
user.notprivileged: sockd
logoutput: /var/log/sockd.log

client pass {
        from: 0.0.0.0/0  to: 0.0.0.0/0
}
client block {
        from: 0.0.0.0/0 to: 0.0.0.0/0
}
pass {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        protocol: tcp udp
        method: pam
        command: bind connect udpassociate bindreply udpreply
        log: connect disconnect
}
block {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        log: connect error
}

我必须使用固定的宽度和高度,否则背景将变成椭圆形而不是圆形。

这是rounded_transparent_button.xml

<Button
    android:id="@+id/record_button"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="20dp"
    android:layout_centerHorizontal="true"
    android:scaleX="1"
    android:scaleY="1"
    android:background="@drawable/rounded_transparent_button"/>

这是rounded_transparent_button_pressed.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
    android:width="5dp"
    android:color="@color/white" />
</shape>

这是动画代码:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
    android:width="5dp"
    android:color="@color/white" />
<solid android:color="#f00"/>
</shape>

0 个答案:

没有答案