R.java无法修改

发布于 2024-12-22 18:06:49 字数 1992 浏览 11 评论 0原文

我试图修改android中的R.java。我删除了生成的java文件。保存后好像没有什么变化。我的 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.
 */
public final class R {
public static final class attr {
}
public static final class drawable {
    public static final int icon=0x7f020000;
}
public static final class id {
    public static final int myEditText=0x7f050000;
    public static final int myListView=0x7f050001;
}
public static final class layout {
    public static final int colors=0x7f030000;
    public static final int dimens=0x7f030001;
    public static final int main=0x7f030002;
}
public static final class string {
    public static final int app_name=0x7f040001;
    public static final int hello=0x7f040000;
}
}

我想更改它,使其更像这样:

 /* 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.
 */
public final class R {
public static final class attr {
}

public static final class color {
    public static final int notepad_lines=0x7f040001;
    public static final int notepad_margin=0x7f040002;
    public static final int notepad_paper=0x7f040000;
    public static final int notepad_text=0x7f040003;
}
public static final class drawable {
    public static final int icon=0x7f020000;
}
public static final class id {
    public static final int myEditText=0x7f050000;
    public static final int myListView=0x7f050001;
}
public static final class layout {
    public static final int colors=0x7f030000;
    public static final int dimens=0x7f030001;
    public static final int main=0x7f030002;
}
public static final class string {
    public static final int app_name=0x7f040001;
    public static final int hello=0x7f040000;
}
}

每次保存它时都很令人沮丧,它会回到原来的状态,因为它是自动生成的。我该如何修改它?

I was trying to modify the R.java in android. I deleted the generated java files. After saving, it doesn't seem to change anything. The R.java file i have looks like this

/* 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.
 */
public final class R {
public static final class attr {
}
public static final class drawable {
    public static final int icon=0x7f020000;
}
public static final class id {
    public static final int myEditText=0x7f050000;
    public static final int myListView=0x7f050001;
}
public static final class layout {
    public static final int colors=0x7f030000;
    public static final int dimens=0x7f030001;
    public static final int main=0x7f030002;
}
public static final class string {
    public static final int app_name=0x7f040001;
    public static final int hello=0x7f040000;
}
}

I wanted to change it, to be more like this one:

 /* 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.
 */
public final class R {
public static final class attr {
}

public static final class color {
    public static final int notepad_lines=0x7f040001;
    public static final int notepad_margin=0x7f040002;
    public static final int notepad_paper=0x7f040000;
    public static final int notepad_text=0x7f040003;
}
public static final class drawable {
    public static final int icon=0x7f020000;
}
public static final class id {
    public static final int myEditText=0x7f050000;
    public static final int myListView=0x7f050001;
}
public static final class layout {
    public static final int colors=0x7f030000;
    public static final int dimens=0x7f030001;
    public static final int main=0x7f030002;
}
public static final class string {
    public static final int app_name=0x7f040001;
    public static final int hello=0x7f040000;
}
}

It so frustrating every time I save it, it goes back to its old state because it's auto generated . How do I modify it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陌伤浅笑 2024-12-29 18:06:49

R.java 是一个自动生成的文件,包含项目中使用的所有资源。如果你想改变 R.java 你不能。

您必须添加或删除资源,然后它将根据项目中存在的资源进行修改。

这是 Android 中的基本内容。你必须阅读Android开发者文档,然后你才会对此有很好的了解。

R.java is an auto generated file contains all your resources used in project. If you want to change R.java you can't.

You have to add or delete resources, then it will be modified according to your resources present in project.

This is basic thing in Android. You have to read Android Developers documents, then you will get good knowledge about it.

疯了 2024-12-29 18:06:49

你不能在android中修改R.java,它会在我们开发xml文件时自动生成....这里的id号将存储不同的视图,所以我们无法修改它..

You cannot modify R.java in android it will be generated automatically when we are developing an xml file.... here id numbers will be stored of different views so we can't modify it..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文