The User Interface (UI) needs to be simple and glanceable. For managing different form factors of a Wear device, such as a circle and square, we will be using a container, which is also referred to as a screen shape-aware frame layout. For getting the best listing experience, we will be using the latest component, WearableRecyclerView, from the Wear 2.0 support library. WearableRecyclerView has the best architecture, which is identical to RecyclerView.
Note: In case you neglect to include the necessary strings in the strings.xml file, you will experience string missing errors in the activity layout files. Include the strings mandatorily, which we will see now.
Before adding all the UI components, let's add all the string resources to be used. This resource is assumed for the operation that we have planned to implement in the Wear note app.
Add the following resources in strings.xml under the res directory and the value directory:
Next, let's add the WearableRecyclerView list item layout. It's called each_item.xml. For creating a new layout, go to the resdirectory and navigate to the layoutdirectory. Right-click and go to New and then select the Layout resource file. Once the layout file is created, add the following code:
In API level 21, Google officially introduced the RecyclerView component. RecyclerView is a flexible and efficient version of ListView. It is a container for rendering a larger dataset of views that can be recycled and scrolled very efficiently. RecyclerView is like a traditional ListView component but with more flexibility to customize the rendering and performance. WearableRecyclerview is exclusively customized for wearable devices.