Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.78 KB | None | 0 0
  1. public void creacion_fab() {
  2. fab_rankit = (FloatingActionButton) findViewById(R.id.fab_rankit);
  3. fab_buscar = (FloatingActionButton) findViewById(R.id.fab_buscar);
  4. fab_cambioActividad = (FloatingActionButton) findViewById(R.id.fab_cambioActividad);
  5. fab_home = (FloatingActionButton) findViewById(R.id.fab_home);
  6.  
  7. FabOpen = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fab_open);
  8. FabClose = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fab_close);
  9. FabClockwise = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate_anticlockwise);
  10. FabAnticlockwise = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.rotate_clockwise);
  11.  
  12. fab_rankit.setOnClickListener(new View.OnClickListener() {
  13. @Override
  14. public void onClick(View view) {
  15. if (isOpen) {
  16. fab_home.startAnimation(FabClose);
  17. fab_cambioActividad.startAnimation(FabClose);
  18. fab_buscar.startAnimation(FabClose);
  19. fab_rankit.startAnimation(FabClockwise);
  20. fab_home.setClickable(false);
  21. fab_buscar.setClickable(false);
  22. fab_cambioActividad.setClickable(false);
  23. isOpen = false;
  24.  
  25. } else {
  26. fab_home.startAnimation(FabOpen);
  27. fab_cambioActividad.startAnimation(FabOpen);
  28. fab_buscar.startAnimation(FabOpen);
  29. fab_rankit.startAnimation(FabAnticlockwise);
  30. fab_home.setClickable(true);
  31. fab_buscar.setClickable(true);
  32. fab_cambioActividad.setClickable(true);
  33. isOpen = true;
  34. }
  35. }
  36. }); } }
  37.  
  38. xmlns:tools="http://schemas.android.com/tools"
  39. android:id="@+id/id_principalActivity"
  40. android:layout_width="match_parent"
  41. android:layout_height="match_parent"
  42. android:fitsSystemWindows="true"
  43. tools:context="mario.rankit.Principal_Activity">
  44.  
  45.  
  46. <include layout="@layout/content_principal_" />
  47.  
  48. <android.support.design.widget.FloatingActionButton
  49. android:id="@+id/fab_home"
  50. android:layout_width="wrap_content"
  51. android:layout_height="wrap_content"
  52. android:layout_gravity="end"
  53. android:backgroundTint="#0089D5"
  54. android:elevation="6dp"
  55. android:src="@drawable/home"
  56. android:visibility="invisible"
  57. app:fabSize="normal"
  58. app:layout_anchor="@+id/fab_buscar"
  59. app:layout_anchorGravity="top"
  60. app:pressedTranslationZ="12dp"
  61.  
  62. />
  63.  
  64. <android.support.design.widget.FloatingActionButton
  65. android:id="@+id/fab_buscar"
  66. android:layout_width="wrap_content"
  67. android:layout_height="wrap_content"
  68. android:layout_gravity="end"
  69. android:backgroundTint="#0089D5"
  70. android:elevation="6dp"
  71. android:src="@drawable/fab_buscar"
  72. android:visibility="invisible"
  73. app:fabSize="normal"
  74. app:layout_anchor="@+id/fab_cambioActividad"
  75. app:layout_anchorGravity="top"
  76. app:pressedTranslationZ="12dp"
  77.  
  78. />
  79.  
  80. <android.support.design.widget.FloatingActionButton
  81. android:id="@+id/fab_cambioActividad"
  82.  
  83. android:layout_width="wrap_content"
  84. android:layout_height="wrap_content"
  85. android:layout_gravity="end"
  86. android:backgroundTint="#0089D5"
  87. android:elevation="6dp"
  88. android:src="@drawable/fab_publicar"
  89. android:visibility="invisible"
  90. app:fabSize="normal"
  91. app:layout_anchor="@+id/fab_rankit"
  92. app:layout_anchorGravity="top"
  93. app:pressedTranslationZ="12dp" />
  94.  
  95. <android.support.design.widget.FloatingActionButton
  96. android:id="@+id/fab_rankit"
  97. android:layout_width="75dp"
  98. android:layout_height="74dp"
  99. android:layout_gravity="bottom|end"
  100. android:layout_margin="@dimen/fab_margin"
  101. android:backgroundTint="#0089D5"
  102. android:elevation="6dp"
  103. android:icon="@mipmap/ic_launcher"
  104. android:src="@drawable/logofinal"
  105. app:fabSize="normal"
  106. app:pressedTranslationZ="12dp"
  107.  
  108. />
  109.  
  110.  
  111. <android.support.design.widget.AppBarLayout
  112. android:layout_width="match_parent"
  113. android:layout_height="wrap_content"
  114. android:theme="@style/AppTheme.AppBarOverlay">
  115.  
  116. <android.support.v7.widget.Toolbar
  117. android:id="@+id/toolbar"
  118. android:layout_width="match_parent"
  119. android:layout_height="?attr/actionBarSize"
  120. android:background="@color/colorToolbar"
  121. android:title="@string/titulo_principal"
  122. app:popupTheme="@style/AppTheme.PopupOverlay" />
  123.  
  124. </android.support.design.widget.AppBarLayout>
  125.  
  126. <ImageView
  127. android:layout_width="42dp"
  128. android:layout_height="42dp"
  129. android:layout_marginLeft="310dp"
  130. android:layout_marginTop="6dp"
  131. android:background="@drawable/buscar" />
  132.  
  133. <ImageView
  134. android:id="@+id/bt_alertas"
  135. android:layout_width="42dp"
  136. android:layout_height="42dp"
  137. android:layout_marginLeft="250dp"
  138. android:layout_marginTop="6dp"
  139. app:srcCompat="@drawable/alertas" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement