修改r.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 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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值