English subtitles

← Activated List Item Style - Developing Android Apps

Get Embed Code
10 Languages

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

  1. From the documentation,
    we want single choiceMode
  2. so that the list item only shows
    one selected item at a time.
  3. We can declare this attribute
    on the ListView
  4. in the fragment_main file.
  5. However, we don't want to specify
    choiceMode in one pane mode.
  6. To have these different code paths,
  7. we could copy the file
    in the Layout folder
  8. and put it in the Layout-sw600dp folder.
  9. A better solution is to declare a style,
  10. so we have one layout file
    but different styles.
  11. In the Base styles file
    in the Values folder,
  12. we declare ForecastListStyle.
  13. We leave it empty because we don't need
    to specify choiceMode.
  14. We create a new styles file
    in the values-sw600dp folder.
  15. In the two-pane case,
  16. the ForecastListStyle
    does include the choiceMode.
  17. The two files have a different
    number of styles.
  18. If it's not declared a higher folder,
  19. then it will just fall back
    to the Base style.