Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/222.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用android XML文件进行更改_Android_Xml_View - Fatal编程技术网

无法使用android XML文件进行更改

无法使用android XML文件进行更改,android,xml,view,Android,Xml,View,我想构建一个如下所示的XML文件: 但我不能。有人能告诉我为什么会这样吗?如何制作编辑框提示的中心 特殊编辑框 这是我的密码: 在要居中的edittext xml中添加android:gravity=center\u horizontal,并从电子邮件文本视图中删除android:layout\u centerHorizontal=true。您还应该删除不推荐使用的android:password=true。当一行xml代码为黄色时,请给出一点提示。它可能有问题,也可能有问题。将其悬停并查看消息

我想构建一个如下所示的XML文件:

但我不能。有人能告诉我为什么会这样吗?如何制作编辑框提示的中心

特殊编辑框

这是我的密码:

在要居中的edittext xml中添加android:gravity=center\u horizontal,并从电子邮件文本视图中删除android:layout\u centerHorizontal=true。您还应该删除不推荐使用的android:password=true。当一行xml代码为黄色时,请给出一点提示。它可能有问题,也可能有问题。将其悬停并查看消息,然后单击左侧的灯泡以获取更多选项。下面这样的东西应该可以用

<!--  Email Label -->
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="Large Text"
                android:id="@+id/textView"
                android:layout_below="@+id/topBar"
                android:textColor="#fe9900"
                android:layout_weight="0.07"
                android:layout_gravity="center_horizontal" />

            <EditText android:layout_width="268dp"
                android:layout_height="match_parent"
                android:layout_marginTop="5dip"
                android:layout_marginBottom="20dip"
                android:singleLine="true"
                android:background="#ffffff"
                android:gravity="center_horizontal"
                android:hint="Enter Email Address" />
            <!--  Password Label -->
            <EditText android:layout_width="274dp"
                android:layout_height="fill_parent"
                android:layout_marginTop="5dip"
                android:singleLine="true"
                android:password="true"
                android:gravity="center_horizontal"
                android:background="#ffffff"
                android:hint="Password" />
我看到这里有几个问题。1-填充父项已在6年前被弃用。改为使用匹配父项。2-您使用了大量嵌套布局,这些布局实际上并不需要,而且会对性能产生影响。如果使用正确,您只需要一个RelativeLayout。而且会表现得更好。
<!--  Email Label -->
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:text="Large Text"
                android:id="@+id/textView"
                android:layout_below="@+id/topBar"
                android:textColor="#fe9900"
                android:layout_weight="0.07"
                android:layout_gravity="center_horizontal" />

            <EditText android:layout_width="268dp"
                android:layout_height="match_parent"
                android:layout_marginTop="5dip"
                android:layout_marginBottom="20dip"
                android:singleLine="true"
                android:background="#ffffff"
                android:gravity="center_horizontal"
                android:hint="Enter Email Address" />
            <!--  Password Label -->
            <EditText android:layout_width="274dp"
                android:layout_height="fill_parent"
                android:layout_marginTop="5dip"
                android:singleLine="true"
                android:password="true"
                android:gravity="center_horizontal"
                android:background="#ffffff"
                android:hint="Password" />