Android字段显示在标题后面

时间:2014-03-04 19:58:23

标签: java android

这就是我得到的:Android emulator

这是代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0099cc"
tools:context=".LoginActivity"
android:orientation="vertical" >

<!--
     The primary full-screen view. This can be replaced with whatever view
     is needed to present your content, e.g. VideoView, SurfaceView,
     TextureView, etc.
-->

<!--
     This FrameLayout insets its children based on system windows using
     android:fitsSystemWindows.
-->

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:text="@string/UNstring" />

    <EditText
        android:id="@+id/editText2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textPassword"
        android:text="@string/PWstring" />

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="@string/LIbutton" />

</LinearLayout>

2 个答案:

答案 0 :(得分:0)

将android:marginTop属性添加到第一个元素以将其关闭。

答案 1 :(得分:0)

你想要动作栏吗? 如果没有,你可以隐藏它。

public void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
getWindow().requestFeature(Window.FEATURE_NO_TITLE);  
setContentView(R.layout.login);
}

并在清单中

Android:theme="@android:style/Theme.Black.NoTitleBar