Вопрос

Я новый до андроида, и я не знаю много о Android. Ну, я создал макет с именем кнопки-layout.xml и первым в первую очередь я добавил относительную макет, и и назвал его слишком кнопкой.

Что происходит, это то, что он создал R.java и навязывал ссылку на мою макет с именем Public Static Final INT Button-Layout = 0x7F060000; Как вы, люди знают, что вы не можете использовать - В вашей переменной имени, как это незаконно.

Теперь я хочу убрать свой R.java. Любое тело знает решение этой проблемы?

Вставляя мой код нижеКнопка-layout.xml.

    <?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/button-layout">
    <LinearLayout android:id="@+id/button-layout"
        android:layout_height="wrap_content" android:layout_width="fill_parent">
        <TextView android:id="@+id/TextView01"
            android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="First Name"></TextView>
        <EditText android:id="@+id/EditText01"
            android:layout_width="wrap_content" android:layout_height="wrap_content" android:width="100px"></EditText>
    </LinearLayout>
    <LinearLayout android:id="@+id/LinearLayout02"
        android:layout_below="@id/LinearLayout01" android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <TextView android:id="@+id/TextView02"
            android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Last Name"></TextView>
        <EditText android:id="@+id/EditText02"
            android:layout_width="wrap_content" android:layout_height="wrap_content" android:width="100px"></EditText>
    </LinearLayout>
    <LinearLayout android:id="@+id/LinearLayout03"
        android:layout_below="@id/LinearLayout02" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:layout_centerInParent="true">
        <Button android:id="@+id/Button01"
            android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Submit"></Button>
    </LinearLayout>
</RelativeLayout>

R.JAVA

/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package com.geniteam.mytest;

public final class R {
    public static final class attr {
    }
    public static final class color {
        public static final int blue=0x7f050000;
    }
    public static final class drawable {
        public static final int golden_gate=0x7f020000;
        public static final int icon=0x7f020001;
    }
    public static final class id {
        public static final int Button01=0x7f060008;
        public static final int Button02=0x7f060010;
        public static final int EditText01=0x7f060003;
        public static final int EditText02=0x7f060006;
        public static final int LinearLayout01=0x7f060001;
        public static final int LinearLayout02=0x7f060004;
        public static final int LinearLayout03=0x7f060007;
        public static final int RelativeLayout01=0x7f06000e;
        public static final int TextView01=0x7f060002;
        public static final int TextView02=0x7f060005;
        public static final int backbutton=0x7f060014;
        public static final int btn_FNname=0x7f060011;
        public static final int btn_cancel=0x7f06000c;
        public static final int btn_shahzad=0x7f060012;

Public Static Final INT Button-Layout = 0x7F060000; // Вот ошибка

        public static final int editFirstName=0x7f060016;
        public static final int editLastName=0x7f060017;
        public static final int entry=0x7f06001a;
        public static final int firstName=0x7f060015;
        public static final int image=0x7f06000a;
        public static final int label=0x7f060019;
        public static final int lastName=0x7f060018;
        public static final int layout_root=0x7f060009;
        public static final int layout_shahzad=0x7f06000d;
        public static final int ok=0x7f06001b;
        public static final int relative_layout=0x7f060013;
        public static final int text=0x7f06000b;
        public static final int txt_label=0x7f06000f;
    }
    public static final class layout {
        public static final int abc=0x7f030000;
        public static final int custom_dialog=0x7f030001;
        public static final int frame_layout=0x7f030002;
        public static final int layout_shahzad=0x7f030003;
        public static final int main=0x7f030004;
        public static final int next_screen=0x7f030005;
        public static final int relative_layout=0x7f030006;
        public static final int relative_test_layout=0x7f030007;
    }
    public static final class string {
        public static final int app_name=0x7f040000;
        public static final int hello=0x7f040001;
        public static final int hello_new=0x7f040002;
    }
}
Это было полезно?

Решение

Файл R.Java автоматически генерируется компилятором ресурсов (AAPT). Поэтому каждый раз, когда вы вносите изменения в ваш проект, и сохраните, файл R.Java перестраивается.

Другие советы

R.java снова перестраивается, когда вы создаете свой проект, вставьте его не удалять его и повторно построить ....

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top