Skip to main content

Popular posts from this blog

#3: Collapsing Toolbar

Collapsing Toolbar         CollapsingToolbarLayout is a ViewGroup that provides many of the visual characteristics and interactions for collapsing toolbars specified in the material guidelines. To create the collapsing toolbar, CollapsingToolbarLayout integrates with AppBarLayout, CoordinatorLayout, Toolbar, and a scrollable content view, such as RecyclerView. How to work with Collapsing Toolbar:     To add a collapsing toolbar to your layout, place the CollapsingToolbarLayout inside an AppBarLayout. Then, add a Toolbar and any other views as a child to the CollapsingToolbarLayout. Make sure that the entire view structure is inside a CoordinatorLayout to take advantage of CollapsingToolbarLayout’s scrolling and features. Sample Code: <android.support.design.widget.CoordinatorLayout     android:layout_width="match_parent"     android:layout_height="match_parent">     <!-- Scrollable view ...

#1: Layouts in Android

Layouts A layout defines the structure for a user interface in your app, such as in an  activity . All elements in the layout are built using a hierarchy of  View  and  ViewGroup  objects. A  View  usually draws something the user can see and interact with. Whereas a  ViewGroup  is an invisible container that defines the layout structure for  View  and other ViewGroup  objects, as shown in figure 1. Figure 1.  Illustration of a view hierarchy, which defines a UI layout The  View  objects are usually called "widgets" and can be one of many subclasses, such as  Button  or  TextView . The  ViewGroup  objects are usually called "layouts" can be one of many types that provide a different layout structure, such as  LinearLayout  or  ConstraintLayout   . You can declare a layout in two ways: Declare UI elements in XML . Android provides a straightforward ...