0

enter image description here

as you can see from the image above, there is something like a line with height 1dp with width match parent in the top of bottom navigation view. how to make a horizontal line like that ?

I have tried to add that line inside bottom view like this

<com.google.android.material.bottomnavigation.BottomNavigationView
            android:layout_width="0dp"
            android:layout_height="50dp"
            app:elevation="0dp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            android:background="@color/grey_light_medium"
            app:itemIconTint="@color/bottom_navigation_color"
            app:itemTextColor="@color/bottom_navigation_color"
            app:menu="@menu/bottom_navigation_menu"
            app:labelVisibilityMode="unlabeled"
            android:id="@+id/bottom_nav">

        <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

            <view
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    app:layout_constraintTop_toTopOf="parent"
                    android:background="@color/grey_dark_top">

            </view>


        </androidx.constraintlayout.widget.ConstraintLayout>

    </com.google.android.material.bottomnavigation.BottomNavigationView>

but my app crash with error message:

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main) <--- on this line in my Activity

  }
Alexa289
  • 8,089
  • 10
  • 74
  • 178
  • You have a lowercase-`v` `` element without a `class` attribute. You meant to use uppercase-`V` `` instead. Additionally, I doubt that you can put anything inside a ``. Move that out into the ``'s parent, and align it there instead. Also, it's pointless to wrap that in a ``, so you can just get rid of that. – Mike M. Apr 12 '20 at 04:20

0 Answers0