Are Activity/Fragment Transitions compatible with pre-Lollipop devices?

No, Activity/Fragment Transitions are not possible on pre-Lollipop devices. According to the documentation: Start an activity with additional launch information, if able. In Android 4.1+ additional options were introduced to allow for more control on activity launch animations. Applications can use this method along with ActivityOptionsCompat to use these animations when available. When run on … Read more

Rounded corners on material button

With the Material Components Library:. Add the dependency to your build.gradle: dependencies { implementation ‘com.google.android.material:material:1.3.0’ } In this case you can use a MaterialButton in your layout file: <com.google.android.material.button.MaterialButton …. style=”@style/Widget.MaterialComponents.Button” app:cornerRadius=”..” app:strokeColor=”@color/colorPrimary”/> Use app:cornerRadius attribute to change the size of corner radius. This will round off the corners with specified dimensions. You can also … Read more

Change dialog button color

You can use the MaterialAlertDialogBuilder provided by the Material Components library which allows the creation of a Material AlertDialog. Just use: new MaterialAlertDialogBuilder(MainActivity.this, R.style.MyThemeOverlay_MaterialComponents_MaterialAlertDialog) .setTitle(“Dialog”) .setMessage(“Lorem ipsum dolor ….”) .setPositiveButton(“Ok”, /* listener = */ null) .setNegativeButton(“Cancel”, /* listener = */ null) .show(); Then define your custom style, using the buttonBarPositiveButtonStyle and buttonBarNegativeButtonStyle attributes: <!– Alert … Read more

transparent Actionbar with AppCompat-v7 21

<!– Application theme. –> <style name=”AppTheme” parent=”Theme.AppCompat.Light”> <item name=”android:actionBarStyle”>@style/MyActionBar</item> <!– Support library compatibility –> <item name=”actionBarStyle”>@style/MyActionBar</item> </style> <!– ACTION BAR STYLES –> <style name=”MyActionBar” parent=”@style/Widget.AppCompat.ActionBar”> <item name=”android:background”>@drawable/actionbar_background</item> <item name=”android:windowActionBarOverlay”>true</item> <!– Support library compatibility –> <item name=”background”>@drawable/actionbar_background</item> <item name=”windowActionBarOverlay”>true</item> </style>

Is any difference between a MaterialButton and a simple Button?

If you are using a MaterialComponents Theme there is no difference between <Button /> and <com.google.android.material.button.MaterialButton />. There is an auto-inflation enabled which will replace <Button with <com.google.android.material.button.MaterialButton at runtime. The MaterialComponentsViewInflater replaces some framework widgets with Material Components ones at inflation time, provided if a MaterialComponents theme is in use. Something similar happens also … Read more