Okay, it's time to start developing your user interface.
As stated previously, views in Android are the basic building blocks for user interface components. Anytime you implement a user interface component, such as a Layout, TextView, and so on, in the Android system, you are using a view.
So that Android knows how to lay out your view on the screen, however, you must configure a couple of attributes. These attributes, known in the Android SDK as LayoutParams, are
If you're using a static layout, these two attributes must be set in the XML layout. If you're creating views dynamically through code, the layout parameters must be set through Java code. Either way, you cannot do without them. I do not cover dynamic creation of views in this book. For more about dynamic creation of views, refer to the API samples that come with the Android SDK.
If you forget to provide values for layout_width or layout_height, your Android application will crash when rendering the view. Thankfully, you are reminded of this sort of omission quickly when you test your application.
These attributes accept any pixel value or density-independent pixel value (density-independent pixels will be explained in Chapter 9) to specify their respective dimensions. However, ...