У меня есть прокручиваемый макет и я добавил кнопку плавающего меню. Это все работает, но кнопка зафиксирована в позиции на макете, я хочу, чтобы кнопка была закреплена в нижней части экрана.
Если пользователь прокручивает вверх и вниз, кнопка фиксируется на позиции экрана, а не на макете, другими словами, она всегда остается в правом нижнем углу независимо от того, где находится вид прокрутки на * 1003. *
То, что я прочитал, люди говорят, что используют Относительный макет, но я уверен, что я выбрал Constraint Layout, потому что я хотел, чтобы макет был прокручиваемым. Вот пример, с которым я все время сталкиваюсь:
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="end|bottom"
Будем очень признательны за любые указания Включение внизу)
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:id="@+id/ScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".StockEnquiry">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/StockCodeLayout"
android:layout_width="200dp"
android:layout_height="60dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/BarcodeLayout">
<EditText
android:id="@+id/StockCode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/text_boarder"
android:focusable="false"
android:inputType="none"
android:maxLines="1"
android:padding="10dp"
android:paddingLeft="5dp"
android:singleLine="true" />
<TextView
android:id="@+id/StockCodetext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="7dp"
android:background="#ffffff"
android:text="Stock Code" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/SupplierLayout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/SoldLayout">
<EditText
android:id="@+id/supplier"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/text_boarder"
android:focusable="false"
android:inputType="none"
android:maxLines="1"
android:padding="10dp"
android:paddingLeft="5dp"
android:singleLine="true" />
<TextView
android:id="@+id/supplierText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="7dp"
android:background="#ffffff"
android:text="Supplier" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/TestLayout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="200dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/SupplierLayout">
<EditText
android:id="@+id/test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/text_boarder"
android:focusable="false"
android:inputType="none"
android:maxLines="1"
android:padding="10dp"
android:paddingLeft="5dp"
android:singleLine="true" />
<TextView
android:id="@+id/testext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="7dp"
android:background="#ffffff"
android:text="Some Test Box" />
</RelativeLayout>
<include
layout="@layout/floating_menu"
android:layout_width="411dp"
android:layout_height="0dp"
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
Обновлено с изменением Афзал-хана, ответ:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".StockEnquiry">
<ScrollView
android:id="@+id/ScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/StockCodeLayout"
android:layout_width="200dp"
android:layout_height="60dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/BarcodeLayout">
<EditText
android:id="@+id/StockCode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/text_boarder"
android:focusable="false"
android:inputType="none"
android:maxLines="1"
android:padding="10dp"
android:paddingLeft="5dp"
android:singleLine="true" />
<TextView
android:id="@+id/StockCodetext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="7dp"
android:background="#ffffff"
android:text="Stock Code" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/SupplierLayout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/SoldLayout">
<EditText
android:id="@+id/supplier"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/text_boarder"
android:focusable="false"
android:inputType="none"
android:maxLines="1"
android:padding="10dp"
android:paddingLeft="5dp"
android:singleLine="true" />
<TextView
android:id="@+id/supplierText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="7dp"
android:background="#ffffff"
android:text="Supplier" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/TestLayout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="200dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/SupplierLayout">
<EditText
android:id="@+id/test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/text_boarder"
android:focusable="false"
android:inputType="none"
android:maxLines="1"
android:padding="10dp"
android:paddingLeft="5dp"
android:singleLine="true" />
<TextView
android:id="@+id/testext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="7dp"
android:background="#ffffff"
android:text="Some Test Box" />
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
</ScrollView>
<include
layout="@layout/floating_menu"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</RelativeLayout>