Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Study Jam: Week 1 review - Silvestr Predko

Study Jam: Week 1 review - Silvestr Predko

Study Jam: Week 1 review - Silvestr Predko

GDG Ternopil

March 06, 2016
Tweet

More Decks by GDG Ternopil

Other Decks in Technology

Transcript

  1. What is View? • This class represents the basic building

    block for user interface components. • All of the views in a window are arranged in a single tree. • You can add views either from code or by specifying a tree of views in one or more XML layout files.
  2. Layouts A layout defines the visual structure for a user

    interface, such as the UI for an activity or app widget. You can declare a layout in two ways: • Declare UI elements in XML. Android provides a straightforward XML vocabulary that corresponds to the View classes and subclasses, such as those for widgets and layouts. • Instantiate layout elements at runtime. Your application can create View and ViewGroup objects (and manipulate their properties) programmatically.
  3. ID And R.java Class • If you declare View in

    XML, you must set up ID for it if you want to manipulate with View in code. android:id="@+id/my_button" • R.java is the dynamically generated class, created during build process to dynamically identify all assets.
  4. Relative Layout android:layout_alignParentTop If "true", makes the top edge of

    this view match the top edge of the parent. android:layout_centerVertical If "true", centers this child vertically within its parent. android:layout_below Positions the top edge of this view below the view specified with a resource ID. android:layout_toRightOf Positions the left edge of this view to the right of the view specified with a resource ID.
  5. Frame Layout • You can, however, add multiple children to

    a FrameLayout and control their position within the FrameLayout by assigning gravity to each child, using the android:layout_gravity attribute. • Child views are drawn in a stack, with the most recently added child on top. The size of the FrameLayout is the size of its largest child (plus padding), visible or not (if the FrameLayout's parent permits). top|left bottom|right