Can anyone please suggest about below issue.
I tried to use custom button style having drawable(curve_button.xml) file.
Colors has applied and looking nice but it seems to be issue with
<item name="android:background">@drawable/curve_button</item>
as it didn't applied.
style.xml
<style name="CustomButton" parent="Widget.AppCompat.Button.Borderless.Colored">
<item name="colorButtonNormal">@color/book_appointment</item>
<item name="android:textColor">@android:color/white</item>
<item name="android:background">@drawable/curve_button</item>
</style>
curve_button.xml
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle">
<padding
android:paddingLeft="34dp"
android:paddingRight="34.4dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
/>
<corners android:radius="8dip" />
</shape>
</item>
</selector>
button layout
<Button
android:id="@+id/idBookAppontment"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Book Appointment"
android:theme="@style/CustomButton"
android:layout_marginBottom="12dp"
android:layout_marginTop="6dp"
android:layout_marginLeft="38dp"
android:layout_marginRight="37dp"
android:inputType="textCapWords"
android:layout_gravity="bottom"
local:MvxBind="Typeface StringToFont('Effra_Rg')"
android:layout_below="@id/providerTabbarHost"
android:layout_alignParentBottom="true" />
To change the default Button style of the application we can use the android:buttonStyle attribute in the AppTheme style inside the styles. xml.
XML file saved at res/values/colors.
Styles and themes are declared in a style resource file in res/values/ , usually named styles. xml .
Use this
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<padding android:paddingBottom="16dp" android:paddingLeft="34dp" android:paddingRight="34.4dp" android:paddingTop="16dp" />
<solid android:color="@color/colorAccent" />
<corners android:radius="8dip" />
</shape>
</item>
</selector>
Instead of this
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle">
<padding
android:paddingLeft="34dp"
android:paddingRight="34.4dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
/>
<corners android:radius="8dip" />
</shape>
</item>
</selector>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With