Android - 更改一个xml id会改变另一个

时间:2015-02-12 06:48:20

标签: java android

出于某种原因,当我更改xml文件中某些按钮的id时,它会更改其他xml文件中按钮的名称,这会破坏程序,有人可以解释这里发生了什么,是否可能以某种方式链接?

       <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/third_page"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/main_background_with_touch"
    android:orientation="vertical" >

    <Button
        android:id="@+id/gift"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/keep"
        android:layout_alignParentTop="true"
        android:layout_marginTop="125dp"
        android:background="@drawable/gift_jewellery_but" />

    <Button
        android:id="@+id/keep"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/gift"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="73dp"
        android:background="@drawable/jewellery_self_but" />

    </RelativeLayout>


    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/third_page"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/main_background_with_touch"
    android:orientation="vertical" >

    <Button
        android:id="@+id/existing_user"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/receiver"
        android:layout_below="@+id/receiver"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="28dp"
        android:background="@drawable/generic_button"
        android:minLines="2"
        android:padding="20dp"
        android:text="Do you have jewellery you want to upload a message to? \n (Are you a sender?)"
        android:textColor="@color/white"
        android:textSize="14sp" />

    <Button
        android:id="@+id/about_kiroco"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/existing_user"
        android:layout_below="@+id/existing_user"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="43dp"
        android:background="@drawable/generic_button"
        android:minLines="2"
        android:padding="20dp"
        android:text="I&apos;m not sure. I just want to try out my new jewellery. \n (Test Drive the Jewellery)"
        android:textColor="@color/white"
        android:textSize="14sp" />

    <Button
        android:id="@+id/receiver"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_centerInParent="true"
        android:layout_marginTop="172dp"
        android:background="@drawable/generic_button"
        android:minLines="2"
        android:minWidth="60dp"
        android:padding="20dp"
        android:text="Do you have jewellery you want to receive a message from? \n (Are you a receiver?)"
        android:textAllCaps="false"
        android:textColor="@color/white"
        android:textSize="14sp" />

    </RelativeLayout>

这是两个文件,如果我更改一个布局的id,它会更改另一个的名称以匹配它。

0 个答案:

没有答案