Example to change opacity/alpha of Button or its CompoundDrawables, also demo how to display CompoundDrawables on Button programmatically. Example code: MainActivity.java package com.example.androidsetimageopacity; […]

To practise custom buton, practise a XML file under drawable folder. drawable/colorbutton.xml <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:state_pressed=”true”> <shape> <gradient […]

Some illustration of pre-defined Button style, include buttonStyle, borderlessButtonStyle, buttonStyleToggle as well as buttonStyleInset. <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” android:padding=”10dp” […]

Example of buttons amongst drawable/icon: <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”match_parent” android:padding=”16dp” android:orientation=”vertical” tools:context=”.MainActivity”> <TextView android:id=”@+id/title” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”center_horizontal” android:autoLink=”web” android:text=”https://rootandroid.org//” […]

It’s a real basic illustration to implement onClickListener for Button: – Button A, define onClickListener as anonymous class. – Button B1 […]