Android RelativeLayout:如何删除第二个布局周围的边框?
我有一个Android RelativeLayout:如何删除第二个布局周围的边框?,android,xml,android-layout,Android,Xml,Android Layout,我有一个xml文件,其中包含两个RelativeLayouts。问题在于第二个相对值yout没有达到显示极限。它看起来像布局周围的边框 如何在显示器的边框上显示第二层 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.
xml
文件,其中包含两个RelativeLayout
s。问题在于第二个相对值yout
没有达到显示极限。它看起来像布局周围的边框
如何在显示器的边框上显示第二层
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:background="@color/colorAccent"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="newservice"
tools:showIn="@layout/activity_newservice">
<RelativeLayout
android:id="@+id/test"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark"
android:layout_alignBottom="@+id/viewmap"
android:layout_centerHorizontal="true">
</RelativeLayout>
</RelativeLayout>
删除您的
android:paddingXXX来自家长RelatvieLayout
这是一个问题删除顶部布局上的这一行:
android:paddingTop="@dimen/activity_vertical_margin"
您在顶部添加了一个填充,因此第二个布局不会像您所希望的那样填充第一个布局
问候
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorAccent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="newservice"
tools:showIn="@layout/activity_newservice">
<RelativeLayout
android:id="@+id/test"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark"
android:layout_alignBottom="@+id/viewmap"
android:layout_centerHorizontal="true">
</RelativeLayout>
</RelativeLayout>
试试这个