如何删除默认布局的填充/边距

fra*_*lbo 7 android android-layout

我有以下布局文件:

activity_main.xml中

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:id="@+id/frame_container"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginLeft="0px"
    android:layout_marginRight="0px"
    android:layout_marginTop="0px"
    android:padding="0dp"
    >
    ...
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

和其他一些片段一样

fragment_init.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragmentInit"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="0dp"
    android:layout_marginTop="0px"
    android:layout_marginLeft="0px"
    android:layout_marginRight="0px"
    android:background="#549F07"
    >

    <TextView
        ... 
    >
    ...
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

Lint中的一切看起来都很好,但是当我在Nexus 7 5.0.2上执行我的应用程序时,每个容器都会显示一个填充或边距可能为10像素.

这由下图中的箭头说明 在此输入图像描述

如何强制布局不添加这些填充/边距?

编辑:我应该添加我插入片段的方式.

Activiy

 public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
        fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
        fragmentTransaction.replace(R.id.frame_container, new Fragment_init(), "Fragment_init").commit();
    }
}
Run Code Online (Sandbox Code Playgroud)

而且我在任何地方都不使用任何尺寸... Thks

Arl*_*ind 29

进入此文件res/values/dimens.xml并将值更改为0dp,就像在下面的代码中一样.

<dimen name="activity_horizontal_margin">0dp</dimen>
<dimen name="activity_vertical_margin">0dp</dimen>
Run Code Online (Sandbox Code Playgroud)