2017-05-13 10 views
0

私はBottomNavigationViewの上に影のカスタムビューを追加しようとしましたが、1つの問題があります。BottomNavigationビュー不思議な内部ビュー

BottomNavigationViewには、2人の間接的な子供 - BottomNavigationMenuViewViewがあります。後者のViewは1dpの幅を持ち、BottomNavigationViewの上に示されています。 それでBottomNavigationViewと私のカスタムシャドウの間に1dpのギャップができます。

このViewは何ですか、どうすれば避けられますか?ここで

レイアウトです:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <TextView 
     android:id="@+id/content" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_above="@+id/bottom_navigation" /> 

    <View 
     android:id="@+id/bottom_shadow" 
     android:layout_width="match_parent" 
     android:layout_height="6dp" 
     android:layout_above="@+id/bottom_navigation" 
     android:background="@drawable/shadow" /> 

    <android.support.design.widget.BottomNavigationView 
     android:id="@+id/bottom_navigation" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     app:menu="@menu/navigation" /> 

</RelativeLayout> 

P.S.私はそれを発見した、その奇妙なビューは実際にはの中にボトムナビゲーションビューとギャップがありません。だからそれは問題を作りません。ここにレイアウトインスペクタのスクリーンショットがあります。 enter image description here しかし、まだ興味深いことに、このViewは何ですか?

+1

あなたはポストを更新した –

+0

スクリーンショットを追加することができます。 – Alexey

答えて

0

1dpのギャップについては、おそらく速い修正は、android:layout_marginBottom="-1dp"を設定して、基本的にビューをその差だけ下に強制的に移動させることです。あなたは間接的な子供のためのコードを持っていますか? BottomNavigationViewのソースコードは、スペアの "View"を使用していないようです。

https://android.googlesource.com/platform/frameworks/support/+/master/design/src/android/support/design/widget/BottomNavigationView.java

+0

投稿を更新しました。 – Alexey

関連する問題