【发布时间】:2012-10-19 22:35:31
【问题描述】:
我的问题是屏幕底部有一条白线。我不知道它为什么在那里。它看起来像这样:
此布局是在 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>
我还注意到,它仅在我的应用程序启动后才会发生。如果我从另一个活动 bzy startActivity(intent) 来到这里,那这条线就消失了。
任何帮助将不胜感激。
【问题讨论】:
-
您是否为您的应用设置了 Holo-Light 主题?尝试使用普通的 Holo 主题。另外,我认为
android:orientation="vertical"对RelativeLayout无效。 -
感谢您的宝贵时间。我按照您的建议使用普通全息进行了尝试,并删除了 android:orientation="vertical" 这是之前尝试遗留下来的。情况仍然保持不变,线仍然存在。
-
您的布局中还有其他内容吗?我在 Eclipse 布局编辑器中尝试了发布的布局,至少看不到白线。您是否以编程方式添加或修改任何内容?
-
在 Eclipse 中的预览显示它没有线。我还没有在真机上测试过,线路在模拟器中。我不会以编程方式对布局做任何事情。
-
布局完美...只需检查您的活动主题