Android Question how to change material button color using manifest. using drawable?

b4xqar

Member
Licensed User
HI i simply want to change color of button in the app using theme and manifest editor
here's my snippet


HTML:
CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Material.Light.DarkActionBar">
        <item name="android:colorPrimary">#FF9800</item>
        <item name="android:colorPrimaryDark">#F57C00</item>
        <item name="android:colorAccent">#FFA726</item>
        <item name="buttonStyle">@style/Mybutton</item>
    </style>
    <style name="Mybutton" parent="@android:style/Widget.Material.Button">
        <item name="background">#ff0000</item>
    </style>
</resources>
    )

I try for hours and yet not get the result.

B4X:
B4A Version: 9.01.2
Java Version: 8
Parsing code.    (0.00s)
Building folders structure.    (0.02s)
Compiling code.    (0.01s)
Compiling layouts code.    (0.00s)
Organizing libraries.    (0.00s)
Generating R file.    (0.00s)
Compiling generated Java code.    (0.03s)
Convert byte code - optimized dex.    (1.79s)
Packaging files.    Error
Failed to generate resource table for split ''
res\values\theme.xml:10: error: Error: Color types not allowed (at 'background' with value '#ff0000').

how to create drawable of solid colors ?

many many, many many thanks
 
Top