Matt
Matt

Reputation: 3912

Background image does not seem to fill entire screen

The below picture shows that there are vertical "lines" running down the sides of each side of the screen. The background image seems to fill most of the screen but then there are these lines and the picture does not line up. See where I marked these lines with the black arrows. There seems to be no horizontal lines at the top and bottom of the screen. I cannot find any reason for this.

enter image description here

Below is some relevant code that might be where the problem is residing.

AndroidManifest.xml

<activity
    android:label="@string/app_name"
    android:name=".MainMenu"
    android:screenOrientation="portrait" 
    android:theme="@android:style/Theme.Translucent.NoTitleBar" />

Here is a section of my styles.xml that is referenced in my AndroidManifest.xml.

<style name="Theme.Transparent" parent="android:Theme">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:backgroundDimEnabled">false</item>
</style>

EDIT

Just to clarify, this problem occurs on all the layouts, not just the one below.

mainmenu.xml

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/relativelayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:paddingLeft="5dp"
    android:paddingRight="5dp"
    android:paddingBottom="5dp"
    android:paddingTop="5dp" > 

    <TextView  
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:paddingTop="75dp"
        android:textSize="60sp" />

    <LinearLayout
        android:id="@+id/linearlayout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:orientation="vertical"
        android:fillViewport="true"
        android:paddingTop="175dp" > 

        <TextView  
            android:id="@+id/playBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginBottom="12dp"
            android:textSize="30sp"
            android:background="@color/transparent"
            android:textColor="@color/onclicktextviewhighlight" />

        <TextView
            android:id="@+id/highscoresBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginBottom="12dp"
            android:textSize="30sp"
            android:background="@color/transparent"
            android:textColor="@color/onclicktextviewhighlight" />

        <TextView
            android:id="@+id/optionsBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textSize="30sp"
            android:background="@color/transparent"
            android:textColor="@color/onclicktextviewhighlight" />
    </LinearLayout>
</RelativeLayout>

Upvotes: 0

Views: 305

Answers (2)

Bumbolt
Bumbolt

Reputation: 157

The padding. Like tyczj said. Also there IS a horizontal line

enter image description here

Upvotes: 1

tyczj
tyczj

Reputation: 73916

because you have padding in your layout

android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingBottom="5dp"
android:paddingTop="5dp"

Upvotes: 2

Related Questions