activity_main.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. xmlns:app="http://schemas.android.com/apk/res-auto"
  4. xmlns:tools="http://schemas.android.com/tools"
  5. android:layout_width="match_parent"
  6. android:layout_height="match_parent"
  7. android:orientation="vertical"
  8. tools:context=".MainActivity">
  9.  
  10. <Button
  11. android:id="@+id/boton1"
  12. android:layout_width="match_parent"
  13. android:layout_height="wrap_content"
  14. android:background="@android:color/holo_green_light"
  15. android:text="Condicional if" />
  16.  
  17. <Button
  18. android:id="@+id/boton2"
  19. android:layout_width="match_parent"
  20. android:layout_height="wrap_content"
  21. android:background="@android:color/holo_orange_light"
  22. android:text="Condicional switch" />
  23.  
  24. <Button
  25. android:id="@+id/boton3"
  26. android:layout_width="match_parent"
  27. android:layout_height="wrap_content"
  28. android:background="@android:color/holo_purple"
  29. android:text="Bucle while" />
  30.  
  31. <Button
  32. android:id="@+id/boton4"
  33. android:layout_width="match_parent"
  34. android:layout_height="wrap_content"
  35. android:background="@android:color/holo_red_light"
  36. android:text="Bucle for" />
  37.  
  38. <Button
  39. android:id="@+id/boton5"
  40. android:layout_width="match_parent"
  41. android:layout_height="wrap_content"
  42. android:background="@android:color/holo_blue_light"
  43. android:text="Bucle for each" />
  44.  
  45. <TextView
  46. android:id="@+id/mensaje"
  47. android:layout_width="match_parent"
  48. android:layout_height="match_parent"
  49. android:text="Pulsa uno de los botones" />
  50. </LinearLayout>

Proinf.net