Fragment overlaps the AppCompat toolbar

后端 未结 5 997
感动是毒
感动是毒 2020-12-13 09:41

I\'m working with the v7 support library and trying to have a navigation drawer on the left. As read elsewhere I set up:

  1. DrawerTest.java: T

5条回答
  •  [愿得一人]
    2020-12-13 10:21

    You put the toolbar in the same Framelayout (with the id = frame_layout_test). FrameLayout overlaps views.

    I guess you are trying to do something like this:

    
    
     
    
    
    
        
    
            
    
            
    
        
    
    

    The layout from above takes a linear layout and aligns the framelayout (where you will inflate your framgemt) below the toolbar ...

    This lines

    android:layout_height="0dp"
    android:layout_weight="1"
    

    says that the DrawerLayout should take the remaining height below the toolbar.

    However, if you want to display a traditional actionbar / toolbar, you don't have to add a toolbar in the xml layout. You simply can change the Theme of the activity to @style/Theme.AppCompat.Light.DarkActionBar

提交回复
热议问题