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