R.java不能修改 [英] R.java can't be modified

查看:763
本文介绍了R.java不能修改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图修改R.java的机器人。我删除生成的Java文件。保存后,它似乎并没有改变任何东西。该R.java文件我有看起来像这样

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?

推荐答案

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

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

您需要添加或删除的资源,那么它会根据你的资源present项目进行修改。

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

这是Android的基本的东西。你必须阅读Android开发者文档,那么你会得到很好的了解一下吧。

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

这篇关于R.java不能修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆