![]() ![]() Toolbar/src/main/res/layout/activity_main.xml) Usually, the app bar is set to be flush with the status bar and the sides of the screen. So, whereas the ViewModel sample had 8dp of padding in the ConstraintLayout, this sample moves that padding to the RecyclerView, so the Toolbar is not inset from the edges. The Toolbar has attributes that mostly set up the size and position. A simple Toolbar can use wrap_content for the height, and it will be sized appropriately for toolbar buttons and such. We will explore the app:theme attribute more in the next section.Īndroid:background allows you to specify the background color, and here we defer to the theme and use whatever we have set there as colorPrimary ( ?attr/colorPrimary). ![]() The theme used by prior sample projects in this book was based on. As the name suggests, this adds an action bar to the top of the activity, with an eye towards it having a dark color, so text will be shown in white for a good contrast. The problem is that we do not want an action bar. The theme has no way of knowing this, and so by default, we would wind up with two app bars, stacked on top of each other: We have our own Toolbar that we want to show instead. There is another base theme, which skips the theme-supplied action bar, leaving it up to us. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |