activity_main.xml 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?xml version="1.0" encoding="utf-8"?><!--
  2. ~ Copyright 2019, The Android Open Source Project
  3. ~
  4. ~ Licensed under the Apache License, Version 2.0 (the "License");
  5. ~ you may not use this file except in compliance with the License.
  6. ~ You may obtain a copy of the License at
  7. ~
  8. ~ http://www.apache.org/licenses/LICENSE-2.0
  9. ~
  10. ~ Unless required by applicable law or agreed to in writing, software
  11. ~ distributed under the License is distributed on an "AS IS" BASIS,
  12. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. ~ See the License for the specific language governing permissions and
  14. ~ limitations under the License.
  15. -->
  16. <androidx.coordinatorlayout.widget.CoordinatorLayout
  17. xmlns:android="http://schemas.android.com/apk/res/android"
  18. xmlns:app="http://schemas.android.com/apk/res-auto"
  19. xmlns:tools="http://schemas.android.com/tools"
  20. android:layout_height="match_parent"
  21. android:layout_width="match_parent">
  22. <androidx.constraintlayout.widget.ConstraintLayout
  23. android:layout_width="match_parent"
  24. android:layout_height="match_parent"
  25. android:orientation="vertical"
  26. android:id="@+id/rootLayout"
  27. tools:context=".MainActivity">
  28. <androidx.constraintlayout.widget.ConstraintLayout
  29. android:id="@+id/toolbarLayout"
  30. android:layout_width="match_parent"
  31. android:layout_height="?attr/actionBarSize"
  32. android:background="?attr/colorPrimary"
  33. app:layout_constraintTop_toTopOf="parent"
  34. >
  35. <!-- REMOVE VISIBILITY GONE TO ADD AN ICON IN THE TOP BAR -->
  36. <ImageView
  37. android:id="@+id/logo_persistent"
  38. android:layout_width="?attr/actionBarSize"
  39. android:layout_height="?attr/actionBarSize"
  40. app:srcCompat="@mipmap/ic_launcher"
  41. app:layout_constraintTop_toTopOf="parent"
  42. app:layout_constraintStart_toStartOf="parent"
  43. android:padding="12dp"
  44. android:contentDescription="@string/r_a_dio_icon"
  45. android:visibility="gone"/>
  46. <androidx.appcompat.widget.Toolbar
  47. android:id="@+id/toolbar"
  48. android:layout_width="0dp"
  49. android:layout_height="?attr/actionBarSize"
  50. android:background="?attr/colorPrimary"
  51. android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
  52. app:menu="@menu/toolbar_menu"
  53. app:layout_constraintStart_toEndOf="@+id/logo_persistent"
  54. app:layout_constraintEnd_toEndOf="parent"
  55. app:layout_constraintTop_toTopOf="parent"
  56. android:layout_marginLeft="-4dp"
  57. android:layout_marginStart="-4dp">
  58. </androidx.appcompat.widget.Toolbar>
  59. </androidx.constraintlayout.widget.ConstraintLayout>
  60. <androidx.coordinatorlayout.widget.CoordinatorLayout
  61. android:layout_width="match_parent"
  62. android:layout_height="0dp"
  63. app:layout_constraintTop_toBottomOf="@id/toolbarLayout"
  64. app:layout_constraintBottom_toTopOf="@id/bottom_nav"
  65. android:layout_weight="1"
  66. >
  67. <androidx.fragment.app.FragmentContainerView
  68. android:id="@+id/nav_host_container"
  69. android:layout_width="match_parent"
  70. android:layout_height="match_parent"
  71. />
  72. </androidx.coordinatorlayout.widget.CoordinatorLayout>
  73. <com.google.android.material.bottomnavigation.BottomNavigationView
  74. android:id="@+id/bottom_nav"
  75. android:layout_width="match_parent"
  76. android:layout_height="wrap_content"
  77. app:menu="@menu/bottom_nav_menu"
  78. android:theme="@style/AppTheme.BottomBar"
  79. android:background="?android:attr/windowBackground"
  80. app:labelVisibilityMode="labeled"
  81. android:animateLayoutChanges="true"
  82. app:layout_constraintBottom_toBottomOf="parent"
  83. />
  84. </androidx.constraintlayout.widget.ConstraintLayout>
  85. </androidx.coordinatorlayout.widget.CoordinatorLayout>