Category : button

I am trying to implement switch button on the toolbar. It shows on the toolbar and turns on and off but there is no functions implemented when it is on or off. I have the switch button in the menu as follows <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_settings" android:title="Settings" app:showAsAction="never"/> <item android:id="@+id/switch_button" android:title="Switch" ..

Read more

Is there a way to align the icon to the start, top, and left of the material button in android XML? Do it programmatically is also acceptable. I would expect app:iconPadding="0dp" to do that, but it doesn’t. The goal is something like this: My XML: <com.google.android.material.button.MaterialButton android:id="@+id/return_button" app:cornerRadius="40dp" app:icon="@drawable/icon_back" app:iconPadding="0dp" app:iconGravity="start" android:layout_width="wrap_content" android:layout_height="wrap_content" tools:text="RETURN" /> ..

Read more

I have created a rectangle with a border rectangle_border.XML and no solid color. <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="50dp" /> <size android:width="50dp" android:height="20dp" /> <stroke android:width="2dp" android:color="@color/White_Flight" /> and I have a button in which I set the background to rectangle_border: <com.google.android.material.button.MaterialButton android:id="@+id/loginPage" android:layout_width="87dp" android:layout_height="27dp" android:layout_marginBottom="10dp" android:background="@drawable/rectangle_border" android:text="@string/login" android:textColor="@color/dark_blue" android:textSize="8sp" app:backgroundTint="@color/White_Flight" app:layout_constraintBottom_toBottomOf="@id/home_background" app:layout_constraintLeft_toLeftOf="parent" ..

Read more