Я хотел бы поставить границу на вершине моего com.google.android.material.bottomappbar.BottomAppBar
. Я пытался применить это drawable
как background
к моим BottomAppBar
:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:left="-5dp"
android:right="-5dp"
android:bottom="-5dp">
<shape android:shape="rectangle" >
<solid android:color="@android:color/white" />
<stroke
android:width="1.8dp"
android:color="@color/midGreen" />
</shape>
</item>
</layer-list>
, но это не сработало.
Вот как реализован мой BottomAppBar:
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/clBottom"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.bottomappbar.BottomAppBar
android:background="@drawable/background_border_mid_green_top"
style="@style/Widget.MaterialComponents.BottomAppBar"
android:id="@+id/bottomAppbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/first_menu_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/ic_weed_shop_2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/second_menu_item"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/second_menu_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/ic_weed_stats"
app:layout_constraintBottom_toBottomOf="@+id/first_menu_item"
app:layout_constraintEnd_toStartOf="@+id/placeholder"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toEndOf="@+id/first_menu_item" />
<View
android:id="@+id/placeholder"
android:layout_width="70dp"
android:layout_height="0dp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/first_menu_item"
app:layout_constraintEnd_toStartOf="@+id/third_menu_item"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toEndOf="@+id/second_menu_item"
app:layout_constraintTop_toTopOf="@+id/first_menu_item" />
<ImageView
android:id="@+id/third_menu_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/ic_edibles"
app:layout_constraintBottom_toBottomOf="@+id/first_menu_item"
app:layout_constraintEnd_toStartOf="@+id/fourth_menu_item"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toEndOf="@+id/placeholder" />
<ImageView
android:id="@+id/fourth_menu_item"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/ic_logo_v2"
app:layout_constraintBottom_toBottomOf="@+id/first_menu_item"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toEndOf="@+id/third_menu_item"
app:layout_constraintTop_toTopOf="@+id/first_menu_item" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.bottomappbar.BottomAppBar>
<com.google.android.material.floatingactionbutton.FloatingActionButton
app:backgroundTint="@color/midGreen"
app:borderWidth="2dp"
app:layout_anchor="@id/bottomAppbar"
android:id="@+id/fab"
android:backgroundTint="@color/mainGreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:src="@drawable/ic_plus_without_circle_white"
android:layout_marginBottom="30dp"
android:clickable="true"
app:tint="@android:color/white"
android:focusable="true"
app:rippleColor="@android:color/white" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Если вам нужен еще какой-то элемент моего кода, не стесняйтесь.