-2
Hello, I have a Layout. xml that has a text as parameter and that in the lower right corner of this screen should be displayed a Floating Action Button, as shown in the preview layout below What in practice does not happen, because in practice the FAB not only does not stay at the edge of the screen, but also overlaps the displayed text, this only happened after updating the version of Constraint in builde.Radle, which may have been?
.xml of the Layout:
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text_cadastroBoi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/vermelho3"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/addAlgo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:clickable="true"
android:elevation="16dp"
android:focusable="true"
android:scaleType="center"
android:src="@drawable/ic_add_unique_ox"
android:visibility="visible"
app:backgroundTint="#fffff9"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:maxImageSize="60dp"
app:pressedTranslationZ="12dp" />
<TextView
android:id="@+id/textview_addBoiLote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="14dp"
android:layout_marginBottom="8dp"
android:background="#212121"
android:padding="8dp"
android:text="Adicionar boi sem Bluetooth"
android:textColor="#ffffff"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/addBoiSemBlue"
app:layout_constraintEnd_toStartOf="@+id/addBoiSemBlue" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/addBoiSemBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginBottom="160dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:elevation="16dp"
android:focusable="true"
android:src="@drawable/ic_ox_unique"
android:visibility="invisible"
app:backgroundTint="#ffffff"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:maxImageSize="56dp"
app:pressedTranslationZ="12dp" />
<TextView
android:id="@+id/textview_addBoi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="23dp"
android:layout_marginBottom="10dp"
android:background="#212121"
android:padding="8dp"
android:text="Adicionar boi via Bluetooth"
android:textColor="#ffffff"
android:visibility="invisible"
app:fabSize="normal"
app:layout_constraintBottom_toBottomOf="@+id/addBovinoBle"
app:layout_constraintEnd_toStartOf="@+id/addBovinoBle" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/addBovinoBle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginBottom="80dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:elevation="16dp"
android:focusable="true"
android:scaleType="center"
android:src="@drawable/ic_ox_unique_ble"
android:visibility="invisible"
app:backgroundTint="#ffffff"
app:fabSize="normal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:maxImageSize="60dp"
app:pressedTranslationZ="12dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
Edith the question to put the code of the
.xml
. Probably this is because theConstraintLayout
is not occupying the entire screen. As for the FAB being in front of the text, as far as I understand this is the expected behavior.– Rafael Tavares
Edited, so you can only put it on the edge of the screen if the textView takes up all the space?
– luke cross
Why -1? The question is correct...
– luke cross