3

my problem is a white line at the bottom of the screen. I have no idea why it is there. It looks like this :

screen

This layout is defined in XML:

<?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:background="@android:color/black"
android:orientation="vertical" >

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
    android:layout_width="250dp"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerInParent="true"
    android:layout_gravity="bottom"
    android:layout_marginBottom="30dp"
    android:orientation="vertical" >

    <!-- MAIN TITLE -->


    <!-- LOGIN TITLE -->

    <TextView
        android:id="@+id/login_label"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/login"
        android:textColor="@android:color/white"
        android:textSize="18sp" />
    <!-- LOGIN TEXT -->

    <EditText
        android:id="@+id/login_text"
        android:layout_width="250dp"
        android:layout_height="wrap_content"
        android:inputType="textNoSuggestions"
        android:background="@android:color/white"
        android:textSize="18dp" />
    <!-- PASSWORD TITLE -->

    <TextView
        android:id="@+id/password_label"
        android:layout_width="250dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="5sp"
        android:text="@string/password"
        android:textColor="@android:color/white"
        android:textSize="18sp" />
    <!-- PASSWORD TEXT -->


    <EditText
        android:id="@+id/password_text"
        android:layout_width="250dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:inputType="textPassword"
        android:background="@android:color/white"
        android:textSize="18dp" />



    <!-- LOG IN BUTTON -->

    <Button
        android:id="@+id/login_button"
        android:layout_width="120dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="#3DB0E1"
        android:padding="12dp"
        android:text="@string/login_button"
        android:textColor="@android:color/white" />
</LinearLayout>    
</RelativeLayout>

I also noticed, that it happens only after launch of my application. If I come here from another activity bzy startActivity(intent), the line is gone. Any help would be appreciated.

slezadav
  • 6,104
  • 7
  • 40
  • 61
  • Do you have Holo-Light theme set for your App? Try it with the normal Holo theme. Also, I think `android:orientation="vertical"` is not valid for `RelativeLayout`. – Ridcully Oct 19 '12 at 09:19
  • Thanks for your time. I tried it with normal holo as you suggested and removed android:orientation="vertical" which was a left over from previous attempts. Situtation still remains the same though, the line is still there. – slezadav Oct 19 '12 at 09:23
  • 1
    Is there anything else in your layout? I tried the posted layout in the eclipse layout-editor and at least there's no white line to be seen. Do you add or modify anything programmatically? – Ridcully Oct 19 '12 at 09:35
  • Preview in eclipse shows it right without the line. I haven't tested it on real device, the line is in emulator. I do not do anything with the layout programatically. – slezadav Oct 19 '12 at 09:41
  • layout is perfect... just check your activity theme – vnshetty Oct 19 '12 at 09:45
  • Activity theme is the same as application theme and in other activities this line is not present. Event in this activity if I navigate here from another one it is not there. – slezadav Oct 19 '12 at 09:48

2 Answers2

0

Your Outer-most Relative layout is unnecessary. Why do You have it?

My solution would be to:

In android:id="@+id/linearLayout1" change

android:layout_marginBottom="30dp"

to

android:paddingBottom="30dp"

in your outer-most Relative layout

OR: Remove Outer most relative layout

Let me know if it works

Jacek Milewski
  • 3,304
  • 1
  • 18
  • 17
  • I have alredy tried changing margin to padding. That had no effect. As of current I have also remove LinearLayout and kept only RelativeLayout as one of them was unnecessary. It is still the same. – slezadav Oct 19 '12 at 13:50
0

Actually it will disappear once you recreate it(bug posted), so all you need to do is basically recreate it.

Intent intent;
intent = getIntent();
if (intent.getBooleanExtra("FIRST", true)) {
    LoginActivity.this.finish();
    intent = new Intent().setClass(LoginActivity.this, LoginActivity.class);
    intent.putExtra("FIRST", false);
    startActivity(intent);
}
Michal
  • 15,429
  • 10
  • 73
  • 104
  • Great ! It is not clean but finally a solution that works. I still wonder why the line was present, I think it's kind of a mystery. – slezadav Oct 19 '12 at 14:38