With the Layout Editor tool in Design mode, locate the main ConstraintLayout component in the Component tree and right-click on it to display the menu shown in Figure 63-3 and select the Convert View. This needs to be converted to a vertically oriented LinearLayout. By default, Android Studio has used a ConstraintLayout as the root layout element in the user interface. Locate the main_fragment.xml file in the Project tool window (app -> res -> layout) and double-click on it to load it into the Layout Editor tool. The remainder of this chapter, therefore, will be used to work step by step through the design of this user interface using the Android Studio Layout Editor tool. ![]() The layout shown in Figure 63-2 is the exact layout that is required for the database example that will be completed in the next chapter. The LinearLayout child view contains three Button children. The TableRows contain two child views, with each child representing the contents of a table column cell. The TableLayout contains three TableRow children representing three rows in the table. The hierarchical tree illustrated in Figure 63-2, however, makes the structure a little easier to understand:Ĭlearly, the layout consists of a parent LinearLayout view with TableLayout, LinearLayout RecyclerView children. In addition, a single cell may be configured to span multiple columns.Ĭonsider the user interface layout shown in Figure 63-1:įrom the visual appearance of the layout, it is difficult to identify the TableLayout structure used to design the interface. Columns may be configured to be shrinkable or stretchable (or both) such that they change in size relative to the parent TableLayout. The number of columns in a table is dictated by the row with the most columns and, by default, the width of each column is defined by the widest cell in that column. Each row within a TableLayout is occupied by a TableRow instance, which, in turn, is divided into cells, with each cell containing a single child view (which may itself be a container with multiple view children). The purpose of the TableLayout container view is to allow user interface elements to be organized on the screen in a table format consisting of rows and columns. ![]() The TableLayout and TableRow Layout Views
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |