To Lecture Notes

IT 372 -- May 1, 2019

Review Questions

  1. If the company domain is it372.cdm.depaul.edu and the application name is MyApp, what is the package name for the project?
    Ans: edu.cdm.it372.myapp
  2. What is the hint attribute for an EditText widget?
    Ans: It is gray text displayed in the widget that tells the user what to enter.
  3. Look at the PhoneButtons example. How do you set a style such as textSize that applies to all widgets?
    Ans: You add a line like this to the app/src/main/res/values/styles.xml file:
    <item name="android:textSize">30sp</item>
    
  4. In a GridLayout, what are the important properties to set to position the widgets? Ans:
     rowCount  columnCount  layout_row  layout_column
    layout_columnSpan   layout_rowSpan
    In a Spinner widget, how do you add entries to the spinner?
    Ans: Create an array in the app/src/main/res/values/strings.xml file:
     <array name="grades">
        <item>Grade 9</item>
        <item>Grade 10</item>
        <item>Grade 11</item>
        item>Grade 12</item>
    </array>
    
    Then assign grades to the entries attribute of the spinner:
    android:entries="@string/grades"
    
  5. How does ConstraintLayout differ from LinearLayout or GridLayout?
    Ans: ConstraintLayout stacks widgets vertically or horizontally.
    GridLayout positions widgets in a rectangular grid.
    ConstraintLayout uses constraints to the edge of the layout or to other widgets to position a widget.

Some ConstraintLayout Videos

Practice with ConstraintLayout

TextMessage Prototype

StudentEntryForm Example

Array Adapters

More Android Widgets