java - 当我在模拟器上运行时,我的应用程序风格发生了变化

标签 java android xml android-layout android-studio

我对应用程序开发有所了解。 当我设计应用程序布局样式时遇到麻烦。看上去不错。正如我想要的应用程序那样好。 但是当我尝试运行它时,所有应用程序都困惑了,全部跳转到应用程序的左上角,有人知道为什么吗? IMG 1

IMG 2

这是布局 xml 代码:

    <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="tech.XXX.LoginA">

    <EditText
        android:id="@+id/tName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="Tech name"
        android:inputType="textPersonName"
        tools:layout_editor_absoluteX="49dp"
        tools:layout_editor_absoluteY="49dp" />

    <Button
        android:id="@+id/bLogin"
        android:layout_width="321dp"
        android:layout_height="98dp"
        android:elevation="0dp"
        android:text="Login"
        tools:layout_editor_absoluteX="32dp"
        tools:layout_editor_absoluteY="151dp" />
</android.support.constraint.ConstraintLayout>

最佳答案

您应该查看一下RelativeLayout。我建议在您的情况下使用RelativeLayout。 https://developer.android.com/guide/topics/ui/layout/relative.html您还可以找到其他教程。

关于java - 当我在模拟器上运行时,我的应用程序风格发生了变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44010643/

相关文章:

android - ANR keyDispatchingTimedOut 错误

java - NoClassDefFound错误: org/apache/xml/serialize/OutputFormat

java - 如何在 Java 中进行多处理,以及期望的速度提升是多少?

java - libGDX foreach 创建对象吗?

android - 有没有办法将 onFocus 事件绑定(bind)到 NativeScript 中的 TextField?

java - Webview加载url但在默认浏览器中打开内容?

java - Android Webview : Cannot call determinedVisibility() - never saw a connection for the pid

java - 带有 64 位 jvm 的 Tesseract

c# - .NET 压缩 XML 以存储在 SQL Server 数据库中

java - 要解析的 'Push Approach' 和 'Pull Approach' 是什么?