Customizing the Android TV user interface
In this section, we will begin by creating a custom header and custom row fragment for our Android TV user interface. The previously generated code that handles the displaying of header and row information currently exists within the MainFragment
class.
In the sections that follow, we will be taking a look at how we can separate this information into two individual classes, which will make the code easier to maintain.
Creating the CustomHeadersFragment class
In this section, we will proceed to create our CustomHeadersFragment
class that inherits from the HeadersFragment
class and will be used to display our list of categories within the side panel of our Android TV user interface.
First, we need to create a new class called CustomHeadersFragment
:
From the Project Navigator window, expand the app section, select and expand the java section.
Next, right-click and choose the New | Fragment | Fragment (Blank) menu option:
Then, enter
CustomHeadersFragment
to...