0

i am working on an android studio app and i want to update the design of a button, i dont know what i am doing wrong.

I have this code for the button:

<Button
    android:id="@+id/signUpBtn"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="15dp"
    android:background="@drawable/loginbutton_selector"
    android:textColor="@color/background_color" />




<TextView
    android:id="@+id/or"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:paddingTop="10dp"
    android:paddingBottom="10dp"
    android:textColor="@color/black" />

The drawable is linked to loginbutton_selector that is like this:

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

    <!-- When item pressed this item will be triggered -->
    <item android:state_pressed="true">
        <shape android:shape="rectangle">
            <corners android:radius="10dp" />
            <solid android:color="#95000000" />
            <stroke android:width="1dp" android:color="@color/background_color" />
        </shape>
    </item>

    <!-- By default the background will be this item -->
    <item>
        <shape android:shape="rectangle">
            <corners android:radius="10dp" />
            <solid android:color="#00000000" />
            <stroke android:width="1dp" android:color="@color/background_color" />
        </shape>
    </item>

</selector>

I want to make changes to the border radius, text size and color but it doesnt seem to work. I am changing the radius and color from code, also from background_color option but it doesnt work.

What am i doing wrong?

Thank you

I tried updating the code, adding new options like the options below but it didnt work.

 <shape android:shape="rectangle"  >
            <corners android:radius="3dip" />
            <stroke android:width="1dip" android:color="#5e7974" />
            <solid android:color="#58857e"/>  

Thank you

Rares Daniel
  • 3
  • 1
  • 2

1 Answers1

0

If you will go to the themes.xml file in your project you will see why it hapens.
This guide must help you https://stackoverflow.com/a/66270134/16983216

PavelZh
  • 29
  • 4
  • Thank you for the reply. I dont have theme.xml , i have styles.xml , as is in here. https://pastebin.com/ai9718TL . On which i should change it? Thank you – Rares Daniel Oct 28 '22 at 07:30
  • Ok, you need to go to your AndroidManifest.xml file. Then in or in tag (it depends on where you are using your button) find "android:theme=" param. Press "ctrl+left mouse button" to see which theme you are using. And then you need to change **parent** theme of your theme to "Theme.AppCompat.Light.DarkActionBar" – PavelZh Oct 28 '22 at 15:23