I have this code and works for every version since API 14 but on Android 5.0 (Lollipop) isn't working correctly.
Below is the way how I want the buttons to appear.
click of button1
buttonArrivals.getBackground().setAlpha(180);
buttonDepartures.getBackground().setAlpha(255);
click of button2
buttonArrivals.getBackground().setAlpha(255);
buttonDepartures.getBackground().setAlpha(180);
On the Lollipop version, the buttons appear with the same Alpha but I never set the same alpha. I just use the code above.
UPDATE 24/11/2014
Here is the XML of the buttons (AutoResizeButton extends Button)
br.com.timo.gru.util.AutoResizeButton
android:id="@+id/buttonArrivals"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#00abbd"
android:drawableLeft="@drawable/icon_aviao_desemb"
android:drawablePadding="-5dp"
android:drawableStart="@drawable/icon_aviao_desemb"
android:gravity="center"
android:paddingEnd="0dp"
android:paddingLeft="2dp"
android:paddingRight="0dp"
android:text="@string/chegadas"
android:textColor="@android:color/white"
br.com.timo.gru.util.AutoResizeButton
android:id="@+id/buttonPartidas"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#00abbd"
android:drawableLeft="@drawable/icon_aviao_partida"
android:drawablePadding="-5dp"
android:drawableStart="@drawable/icon_aviao_partida"
android:ellipsize="end"
android:gravity="center"
android:text="@string/partidas"
android:textColor="@android:color/white"