Android Navigation Drawer and windowActionBarOverlay = true

前端 未结 5 1609
清酒与你
清酒与你 2021-01-30 14:30

I\'m trying to implement the new Android Navigation Drawer in my application. I have created a BaseActivity.java that handles the Drawer setup and listeners, and I have two suba

5条回答
  •  长情又很酷
    2021-01-30 14:45

    You can set a margin at the top of your layout, so that the content draws itself below the ActionBar.

    Just add this in your parent layout:

    android:layout_marginTop="?android:attr/actionBarSize"
    

    The attribute actionBarSize refers to, like you would have already guessed, to the size of the ActionBar. You can't set an absolute value as a margin, since the ActionBar does not always have the same size across all Android devices (It's bigger on tablets, smaller on handset devices).

    Edit:

    Set the margin to the ListView.

    
    
        
    
        
    
    

    The Google Music app does the same:

    enter image description here

提交回复
热议问题