I have the following layout files:
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>
And some other fragments like
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>
Everything looks fine in Lint, but when I execute my application on my Nexus 7 5.0.2, every container is displayed with a padding or margin of maybe 10 px.
This is illustrated by the arrows on the following image
How to force the layouts to not add these padding/margin?
Edit: I should add how I insert my fragment.
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();
}
}
and I don't use any dimens anywhere...
Thks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…