Kahn Kah Kahn Kah - 5 months ago 19
Android Question

Android Programming: Background color not fully covering fragments

So I'm in the middle of creating my first 'real' application in Android.

I'm having a problem with my background color as it not stretches the whole background, I'm still having a box-like grey lines around my app.

I was kind of worried because on the simulator, it shows it like it should be, but on my emulator(s, i tried multiple to check), it shows the following (see pic 2):

Preview:
enter image description here

emulator:
enter image description here

Layout file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#d8edc2">

<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Contact"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:textSize="24dp"
android:textStyle="bold"
android:textColor="#000"
/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:paddingTop="16dp"
android:paddingLeft="10dp"
/>

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:id="@+id/editTextSenderName" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Email"
android:paddingLeft="10dp"
android:paddingTop="16dp"/>

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editTextSenderEmail" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="Subject"
android:paddingTop="16dp"/>

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editTextSenderSubject" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Message"
android:paddingLeft="10dp"
android:paddingTop="16dp"/>

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:lines="5"
android:id="@+id/editTextSenderMessage" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Send message"
android:paddingTop="10dp"
android:id="@+id/buttonSendMessage" />

</LinearLayout>


What could be the problem?

Answer

According to your description, I guess is the Activity of layout problem.You check your layout XML files, check to see if there is the following code:

    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"