Click Effect on Android Button

Asked

Viewed 277 times

0

Hello people I have the following situation;

boot selected.xml

    <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#DBDBDB" />
    <corners android:radius="14dp" />
    <stroke
        android:width="1dp"
        android:color="#DBDBDB" />
</shape>

boot.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#F2F2F2" />
    <corners android:radius="14dp" />


    <stroke
        android:width="1dp"
        android:color="#DBDBDB" />
</shape>

boot.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/botao_selecionado" android:state_pressed="true" /> <!-- pressionado -->
    <item android:drawable="@drawable/botao_selecionado" android:state_focused="true" /> <!-- com foco -->
    <item android:drawable="@drawable/botao_normal" /> <!-- normal-->
</selector>

I put.xml as background:

android:background="@drawable/botao"

Blz tested on my android 9 pie is ok, when I went to test on android 4.3 he didn’t even open the project: Dis that the project stopped, what will be this?

  • Have you tested in 4.3 without using this effect? It seems to me that the problem is not in it.

  • I tested yes, working perfectly without the effect.

  • I don’t see anything in xml that isn’t compatible with 4.3. You have to put the bug log in the question so you can know what the bug is.

  • Mostrou esse error:&#xA;&#xA;java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.escala1002/com.example.escala1002.MainActivity}: android.view.InflateException: Binary XML file line #83: Error inflating class Button

  • I managed to resolve, the xml file created was as v24, then I copied its contents delete the file and created again, when I created was without the v24 dps file name, worked perfectly.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.