Custom Styles
This lesson will cover how to apply custom styles.
We'll cover the following...
Recap #
The login screen is almost ready. It’s time to polish the user interface with some custom styles and colors.
Let’s see what we need to do before applying custom styles. First, we need to make sure that our activity extends AppCompatActivity
.
Press + to interact
public class LoginActivity extends AppCompatActivity {...}
Next, we need to use one of the material component themes inside the activity or application tags in the AndroidManifest.xml file.
Press + to interact
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.travelblog"><applicationandroid:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar"android:label="Travel Blog">...</application></manifest>
Now, all the user interface components are going to use default styles declared in the Theme.MaterialComponents.DayNight.NoActionBar
. Let’s try to extend this theme and overwrite default colors.
Theme overwrite #
Create ...