Android 布局在编辑器中看起来正确,在模拟器上看起来错误

Android 布局在编辑器中看起来正确,在模拟器上看起来错误,android,android-layout,Android,Android Layout,我正在做我的第一个Android项目——一个简单的单活动应用程序,本质上是信息性的。在Android studio中,我将主题设置为material light,并使用Android布局将两个文本视图向右对齐。图一显示了它在Android Studio中的外观。然而,每当我在模拟器或Android设备上运行它时,我都会在图2中看到以下内容。文本左对齐而不是右对齐,主题从白色变为紫色 图1 图2 所以。。。发生什么事?这是一个非常简单的应用程序。下面是我的布局的XML,以便于参考 > 编辑

我正在做我的第一个Android项目——一个简单的单活动应用程序,本质上是信息性的。在Android studio中,我将主题设置为material light,并使用Android布局将两个文本视图向右对齐。图一显示了它在Android Studio中的外观。然而,每当我在模拟器或Android设备上运行它时,我都会在图2中看到以下内容。文本左对齐而不是右对齐,主题从白色变为紫色

图1

图2

所以。。。发生什么事?这是一个非常简单的应用程序。下面是我的布局的XML,以便于参考

>


编辑我的代码:


向左对齐的
文本视图添加以下属性:

android:layout_alignParentRight="true"

另外,要使
ActionBar
的颜色看起来像Android Studio中的颜色,您可以在
styles.xml
文件夹中对其进行更改,它们被称为
colorPrimary
colorPrimaryDark

您是否也想要灰色,还是只想要文本的位置。删除了我的答案,因为我意识到我误读了您想要做的-我看错了文本块。这是什么android版本?我注意到您正在混合alignParentENd和alignParentRight。通常你会用其中一个。如果这是一个足够旧的Android版本,那可能就是问题所在(End并不总是存在)。@Xenolion只是在这一点上进行了调整。我想我知道了如何在Styles.xml中更改主题问题。@Gabeschen这是Android Studio 3.0,带有。。。我不记得API了,只记得Android 5.1。我在回答中添加了一种改变这些颜色的方法,你可以检查@JasonHoltOk是否有效。非常感谢。我还将视图中的文本对齐到视图的末尾。
<TextView
    android:id="@+id/headingNumber"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:fontFamily="@font/abril_fatface"
    android:textSize="42sp"
    android:textAlignment="viewEnd"
    android:padding="16sp"
    android:layout_margin="8sp"
    android:text="JR's Pizza Call
    817-297-3000"
    android:textColor="#9e0f17"
     />

<TextView
    android:id="@+id/mainTextInfo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:textAlignment="viewEnd"
    android:layout_below="@id/headingNumber"
    android:padding="16sp"
    android:layout_margin="16sp"
    android:text="For the best pizza in Crowley, Texas try JR's Pizza.  If you like pepperoni pizza, or pizza with the works, a supreme pizza, or a cheese pizza, JR's Pizza Crowley is here for you. If you like real beef hamburgers you've come to the right place. Or maybe you're in the mood for a fresh salad, pasta, or one of our delicious burritos, we have those on the menu too."
    />
android:layout_alignParentRight="true"