gpt4 book ai didi

android - R.java不可修改

转载 作者:行者123 更新时间:2023-11-29 00:42:21 25 4
gpt4 key购买 nike

我试图修改 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;
}
}

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

最佳答案

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

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

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

关于android - R.java不可修改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8615007/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com