android 让appbarmain中的include空出to

2019-04-17  本文已影响0人  爱垂钓的猫

在写ui的时候突然发现appbarmain中的include无法放在toolbar下方,导致ui在toolbar上有一块重叠的部分,尝试了很久也没办法。最终在github上看到了别人的项目,突然发现了这个解决办法:

例如app_bar_main.xml中include包含的项目为content_main.xml,只需要进入content_main.cml,加入下面这一行代码即可

<FrameLayout  xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools"
      .......
      android:layout_marginTop="?actionBarSize"
      ......
</FrameLayout>
上一篇 下一篇

猜你喜欢

热点阅读