activity_main.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <android.support.constraint.ConstraintLayout 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. tools:context=".MainActivity">
  8.  
  9. <TextView
  10. android:id="@+id/mensaje"
  11. android:layout_width="wrap_content"
  12. android:layout_height="wrap_content"
  13. android:text="¿Qué tiempo hace?"
  14. app:layout_constraintBottom_toBottomOf="parent"
  15. app:layout_constraintLeft_toLeftOf="parent"
  16. app:layout_constraintRight_toRightOf="parent"
  17. app:layout_constraintTop_toTopOf="parent"
  18. app:layout_constraintVertical_bias="0.32999998" />
  19.  
  20. <Button
  21. android:id="@+id/boton1"
  22. android:layout_width="wrap_content"
  23. android:layout_height="wrap_content"
  24. android:layout_marginBottom="8dp"
  25. android:layout_marginEnd="8dp"
  26. android:layout_marginStart="8dp"
  27. android:layout_marginTop="8dp"
  28. android:onClick="alPulsarBoton"
  29. android:text="Llueve"
  30. app:layout_constraintBottom_toBottomOf="parent"
  31. app:layout_constraintEnd_toEndOf="parent"
  32. app:layout_constraintHorizontal_bias="0.15"
  33. app:layout_constraintStart_toStartOf="parent"
  34. app:layout_constraintTop_toBottomOf="@+id/mensaje" />
  35.  
  36. <Button
  37. android:id="@+id/boton2"
  38. android:layout_width="wrap_content"
  39. android:layout_height="wrap_content"
  40. android:layout_marginBottom="8dp"
  41. android:layout_marginEnd="8dp"
  42. android:layout_marginStart="8dp"
  43. android:layout_marginTop="8dp"
  44. android:onClick="alPulsarBoton"
  45. android:text="Despejado"
  46. app:layout_constraintBottom_toBottomOf="parent"
  47. app:layout_constraintEnd_toEndOf="parent"
  48. app:layout_constraintHorizontal_bias="0.85"
  49. app:layout_constraintStart_toStartOf="parent"
  50. app:layout_constraintTop_toBottomOf="@+id/mensaje" />
  51.  
  52. </android.support.constraint.ConstraintLayout>

Proinf.net