Надеюсь, я понял ваш вопрос. Вы можете использовать FrameLayout
или ConstraintLayout
решение.
Это мое решение с использованием FrameLayout
:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="@color/colorPrimary" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|start"
android:layout_margin="16dp"
android:src="@drawable/ic_launcher_foreground" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|end"
android:layout_margin="16dp"
android:src="@drawable/ic_launcher_foreground" />
</FrameLayout>
Результат:
![result](https://i.stack.imgur.com/sZbVs.png)
Это мое решение с использованием ConstraintLayout
:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout_editor_absoluteY="81dp">
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_gravity="center"
android:layout_margin="8dp"
android:background="@color/colorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|start"
android:layout_marginBottom="8dp"
android:layout_marginLeft="84dp"
android:layout_marginStart="84dp"
android:layout_marginTop="8dp"
android:src="@drawable/ic_launcher_foreground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|end"
android:layout_marginBottom="8dp"
android:layout_marginEnd="84dp"
android:layout_marginRight="84dp"
android:layout_marginTop="8dp"
android:src="@drawable/ic_launcher_foreground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" />
</android.support.constraint.ConstraintLayout>
Результат:
![result](https://i.stack.imgur.com/4yG2z.png)
Вы можете использовать различные символы / отступы, чтобы удовлетворить ваши потребности.
Не забудьте добавить implementation 'com.android.support:design:27.1.1'
в файл build.gradle(Module:app)
.