I am fairly new to android studio and I am developing a small app.
I have just added my first buttons but I am having trouble selecting the colour of them. The code i am using in my activity xml is:
<Button
android:id="@+id/signUpButton"
android:text="SIGN UP"
android:textColor="#FFF"
android:textSize="30sp"
android:layout_marginTop="20dp"
android:layout_width="270dp"
android:layout_height="60dp"
android:background="@drawable/buttonshape"
/>
and the code in buttonshape.xml is:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:radius="14dp"
/>
<solid
android:color="#FCB1B1"
/>
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"
/>
<size
android:width="270dp"
android:height="60dp"
/>
<stroke
android:width="3dp"
android:color="#FCB1B1"
/>
</shape>
For some reason the button will not take on the colour specified in the buttonshape.xml and instead will take on the style from the themes.xml file
themes.xml:
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Health_Link" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/salmon</item>
<item name="colorPrimaryVariant">#FFF</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowDisablePreview">true</item>
</style>
<style name="Theme.Health_Link.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.Health_Link.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="Theme.Health_Link.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>