Android XML显示与实时版本不同

时间:2016-04-04 22:19:08

标签: android

我无法弄清楚发生了什么。有一段时间一切都很完美,我为应用程序设置了样式表,在清单中我将每个单独的活动设置为该主题。它工作了一段时间,但现在它正在改变所有显示白色到黑色的项目,我无法弄清楚为什么。这是一张应该如何工作并且工作了一段时间的图片

How it should be (Shows on android designer)

它如何在模拟器和手机上显示

enter image description here

布局文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:background="@drawable/signinbg">

    <Button
        android:id="@+id/login"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/password"
        android:layout_below="@+id/password"
        android:text="login"
        android:nestedScrollingEnabled="false"
        android:background="@color/Blueish"
        android:gravity="center"
        android:layout_centerVertical="true"
        android:layout_marginTop="40dp" />

    <EditText
        android:id="@+id/username"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:ems="10"
        android:focusable="true"
        android:background="@android:drawable/edit_text"
        android:imeOptions="actionNext"
        android:singleLine="true"
        android:gravity="center"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:selectAllOnFocus="true"
        android:layout_marginTop="2dp" />

    <EditText
        android:id="@+id/password"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:background="@android:drawable/edit_text"
        android:ems="10"
        android:imeOptions="actionDone"
        android:password="true"
        android:singleLine="true"

        android:gravity="center"
        android:selectAllOnFocus="true"
        android:layout_below="@+id/textView4"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginTop="2dp" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="Not registered yet? Sign up!"
        android:textSize="20dp"
        android:id="@+id/Register"
        android:textAlignment="center"
        android:clickable="true"
        android:gravity="center"
        android:textColor="@color/White"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginBottom="10dp" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/imageView"
        android:src="@drawable/logo"
        android:paddingBottom="50dp"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textSize="40dp"
        android:text="Sign in"
        android:textColor="@color/White"
        android:id="@+id/textView2"
        android:layout_above="@+id/textView3"
        android:layout_alignLeft="@+id/textView4"
        android:layout_alignStart="@+id/textView4" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text="Username"
        android:id="@+id/textView3"
        android:textColor="@color/White"
        android:textSize="23dp"
        android:layout_above="@+id/username"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="25dp"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text="Password"
        android:id="@+id/textView4"
        android:textColor="@color/White"
        android:textSize="23dp"
        android:layout_below="@+id/username"
        android:layout_alignRight="@+id/textView3"
        android:layout_alignEnd="@+id/textView3"
        android:layout_marginTop="10dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:text="Forgot Password?"
        android:textColor="@color/White"
        android:id="@+id/ForgotPassword"
        android:layout_below="@+id/password"
        android:layout_alignLeft="@+id/textView4"
        android:layout_alignStart="@+id/textView4" />


</RelativeLayout>

样式:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>
    <style name="AppTheme.NoActionBar" parent="AppTheme">
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>
    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>

0 个答案:

没有答案