English subtitles

← Documentation

Get Embed Code
14 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. The documentation for Android, it's on
    a site called developer.android.com.
  2. It contains a lot of helpful
    information, such as code samples,
  3. tutorials and articles.
  4. You can think of it as an instruction
    manual for how to build apps.
  5. I use this site daily, and often times
    I get to it using a Google search.
  6. I'll show you what I mean.
  7. Let's look at the documentation for
    text view.
  8. So I search for textview android.
  9. The top link that comes up is
    a developer.android.com site, so
  10. I click on that.
  11. This is what we call the reference
    documentation for TextView.
  12. I know there's a lot of information on
    this page and it can be overwhelming.
  13. But usually when you're looking
    at reference documentation,
  14. you're trying to solve
    a specific problem.
  15. So you can actually filter out
    all the unnecessary information
  16. that you don't need.
  17. When I come to this page I check
    that it is indeed for TextView.
  18. I may read the class overview,
    and then I can scroll down.
  19. This is the interesting part.
  20. It lists out the XML attributes.
  21. These are all the possible
    XML attributes for TextView.
  22. It also includes a nice description on
    the right-hand side for what it does.
  23. Now you don't need to memorize
    all of these attributes.
  24. In fact, I haven't used some of them.
  25. I usually work with a small subset
    of them on a regular basis.
  26. But I know that if I ever need
    something special, I can always come to
  27. the TextView documentation to
    find that specific attribute.
  28. Here's one that we recognize.
  29. Android:textSize.
  30. So we click on it, and it links to
    the description of this attribute.
  31. It says that this controls
    the size of the text.
  32. And the recommended dimension type for
    text is sp for
  33. scaled pixels, for example, 15sp.
  34. Cool, so we learned this earlier.
  35. And if you ever forget you can always
    come back to the TextView documentation
  36. and look up what the attribute is.
  37. Now say for example I don't
    know what the exact name is.
  38. In your web browser you can use
    the find feature to search the page.
  39. The other way to open up this Find
    window is to use Cmd+F on Mac, or
  40. Ctrl+F on Windows.
  41. Then I can type in what I'm looking for.
  42. Say, for example, I'm looking for
  43. a way to capitalize all
    the letters in a TextView.
  44. This might be useful for example,
    if I'm trying to show tabs like this, or
  45. if I'm creating a snack bar
    at the bottom of the screen,
  46. like this UNDO text here is in all caps.
  47. Buttons are also in all caps.
  48. Going back to the TextView
    documentation, I can search for caps.
  49. I can browse through all the search
    results, but these look pretty good.
  50. It says that there's an XML attribute
    called android:textAllCaps, and
  51. this description says to
    present the text in all caps.
  52. If I click on it and
    read the description,
  53. it sounds like what I'm looking for,
    and it says the possible values for
  54. this attribute are either true or false.
  55. So I can try this out in code now.
  56. So going back to the XML Visualizer,
    say I have this TextView on screen and
  57. I want to change it to be all caps.
  58. According to the documentation,
    I can add an attribute here that says
  59. android:textAllCaps, and
    then I can set it to be true or false.
  60. If I set it to true then look,
    it's all in caps, cool.
  61. The nice thing about this attribute
    is that I don't have to go and
  62. change the text.
  63. Like, oh the possibilities,
    and capitalize everything.
  64. Instead I can leave the text as is,
    and all I need to
  65. do is just toggle this attribute
    to change it from true to false.
  66. Now, it's your turn to practice.
  67. Being able to look at documentation and
    then update your code accordingly to try
  68. it out,
    is a really useful skill to have.
  69. That means you don't have to memorize
    everything you could possibly ever want
  70. to do in Android.
  71. It's only a Google search away and
    you can find it when you need it.
  72. So first,
    I want you to Google search for
  73. textview android to find the reference
    documentation for TextView.
  74. Then I want you to use the Find feature
    in your web browser to search the page
  75. for the XML attribute that makes
    the TextView text bold or italic.
  76. We haven't covered this XML attribute
    before, so this is an opportunity for
  77. you to learn it on you own.
  78. Once you find something that might work,
    go ahead and try to use it.
  79. If that doesn't work
    then no problem at all.
  80. Just keep going back to
    the documentation until you find the one
  81. that works.