user198923
user198923

Reputation: 489

Why isn't my relativelayout filling the screen? - android

I am struggling to figure out why my relativelayout screen is not filling the entire screen. I have tried a number of things, but the horizontal space of the screen never appears filled. What am i doing wrong?

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/splashscreen"
    android:background="@color/splashScreenBackgroundColor"
    >

    <ImageView
        android:id="@+id/imgLogo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:src="@drawable/ic_launcher" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:textSize="12sp"
        android:textColor="#454545"
        android:gravity="center_horizontal"
        android:layout_alignParentBottom="true"
        android:text="MyAppName"
        />

</RelativeLayout>

Upvotes: 3

Views: 92

Answers (2)

Ringo
Ringo

Reputation: 838

The old name is deprecated, change the values to this..

android:layout_width="match_parent"
android:layout_height="match_parent"

Adding singletop will replace the last instance of your activity so if that solved your problem maybe you are instantiating your activity more than once somewhere, and that is why didnt worked before.

Upvotes: 1

user198923
user198923

Reputation: 489

I figured out a solution. I added " android:launchMode="singleTop" " to the relativelayout and it solved the problem!

Upvotes: 0

Related Questions