
<?xml version="1.0" enCoding="utf-8"?> <androID.support.design.Widget.CoordinatorLayout androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:padding="@dimen/activity_horizontal_margin" androID:orIEntation="vertical" tools:context="com.example.sammybobo.moglis.mogliSMaps" xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:androID="http://schemas.androID.com/apk/res-auto" xmlns:tools="http://schemas.androID.com/tools"> <androID.support.v7.Widget.Toolbar androID:layout_wIDth="fill_parent" xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:layout_height="?attr/actionbarSize" androID:ID="@+ID/toolbar" androID:elevation="4dp" androID:theme="@style/themeOverlay.AppCompat.Actionbar" androID:popuptheme="@style/themeOverlay.AppCompat.light"/> <androID.support.design.Widget.floatingActionbutton androID:ID = "@+ID/fab" androID:layout_height="wrap_content" androID:layout_wIDth="wrap_content" androID:src = "@androID:drawable/ic_input_add" androID:layout_gravity = "bottom|end" app:fabSize = "mini"> </androID.support.design.Widget.floatingActionbutton> <fragment androID:layout_wIDth="match_parent" androID:layout_height="200dp" androID:ID="@+ID/main_map" androID:name="com.Google.androID.gms.maps.SupportMapFragment" xmlns:androID="http://schemas.androID.com/apk/res/androID" tools:context = "com.example.sammybobo.moglis.mogliSMaps" xmlns:tools="http://schemas.androID.com/tools" /> <linearLayout androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:background="#fff" androID:layout_gravity = "bottom" > <button androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_weight="1" androID:text="My location" androID:onClick="observe"/> <button androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_weight="1" androID:text = "FrIEnds"/> <button androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_weight="1" androID:text = "settings"/> </linearLayout> </androID.support.design.Widget.CoordinatorLayout>解决方法 这是因为在协调器布局中,您无法将一个视图设置为相对于另一个视图.您只能将它们与父级相关联.尝试下面的布局.
<androID.support.design.Widget.CoordinatorLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:androID="http://schemas.androID.com/apk/res-auto" xmlns:tools="http://schemas.androID.com/tools" androID:layout_height="wrap_content" androID:layout_wIDth="fill_parent" androID:orIEntation="vertical" androID:padding="@dimen/activity_horizontal_margin" tools:context="com.example.sammybobo.moglis.mogliSMaps"> <relativeLayout androID:layout_height="wrap_content" androID:layout_wIDth="fill_parent"> <androID.support.v7.Widget.Toolbar xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:ID="@+ID/toolbar" androID:layout_wIDth="fill_parent" androID:layout_height="?attr/actionbarSize" androID:elevation="4dp" androID:popuptheme="@style/themeOverlay.AppCompat.light" androID:theme="@style/themeOverlay.AppCompat.Actionbar"/> <fragment xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:tools="http://schemas.androID.com/tools" androID:ID="@+ID/main_map" androID:name="com.Google.androID.gms.maps.SupportMapFragment" androID:layout_wIDth="match_parent" androID:layout_height="200dp" androID:layout_below="@+ID/toolbar" tools:context="com.example.sammybobo.moglis.mogliSMaps" /> </relativeLayout> <linearLayout androID:background="#fff" androID:layout_gravity="bottom" androID:layout_height="wrap_content" androID:layout_wIDth="fill_parent" > <button androID:layout_height="wrap_content" androID:layout_weight="1" androID:layout_wIDth="wrap_content" androID:onClick="observe" androID:text="My location"/> <button androID:layout_height="wrap_content" androID:layout_weight="1" androID:layout_wIDth="wrap_content" androID:text="FrIEnds"/> <button androID:layout_height="wrap_content" androID:layout_weight="1" androID:layout_wIDth="wrap_content" androID:text="settings"/> </linearLayout> <androID.support.design.Widget.floatingActionbutton app:fabSize="mini" androID:ID="@+ID/fab" androID:layout_gravity="bottom|end" androID:layout_height="wrap_content" androID:layout_wIDth="wrap_content" androID:src="@androID:drawable/ic_input_add"> </androID.support.design.Widget.floatingActionbutton></androID.support.design.Widget.CoordinatorLayout>
如果您希望底部线性布局也不与片段重叠,则将其放在相对布局中,并确保片段在线性布局上方.
总结以上是内存溢出为你收集整理的android – 在coordinatorlayout中重叠视图全部内容,希望文章能够帮你解决android – 在coordinatorlayout中重叠视图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)