初学android的一个小问题,请各位朋友来帮忙
我修改了 main.xml 然后我在主函数中调用main里面的东西
例如在main.xml加了一个id 我在主函数用 R.id老是调用不出来
如何才能快速的准确的调用出 main.xml里面的东西呢?
答案:额,你在main.xml中加了一个id以后,要右键点save,才会将这个id加入到R中,否则是没有的。。。R里的东西是程序自动生成的~~~
其他:public final class R {
public static final class attr {
}
public static final class drawable {
public static final int back01=0x7f020000;
public static final int back02=0x7f020001;
public static final int black=0x7f020007;
public static final int blue=0x7f020008;
public static final int doc=0x7f020002;
public static final int folder=0x7f020003;
public static final int icon=0x7f020004;
public static final int pdf=0x7f020005;
public static final int violet=0x7f020009;
public static final int white=0x7f020006;
}
public static final class id {
public static final int btBrowse=0x7f050009;
public static final int btExit=0x7f050006;
public static final int btOK=0x7f050007;
public static final int btShow=0x7f05000c;
public static final int cbKeepCaches=0x7f05000b;
public static final int cbUseFontSubstitution=0x7f05000a;
public static final int etPassword=0x7f050005;
public static final int filename=0x7f050008;
public static final int icon=0x7f050003;
public static final int mPath=0x7f050002;
public static final int output=0x7f05000d;
public static final int pagenum_edit=0x7f050001;
public static final int text=0x7f050004;
public static final int username_view=0x7f050000;
}
public static final class layout {
public static final int dialog_pagenumber=0x7f030000;
public static final int file_explorer=0x7f030001;
public static final int file_row=0x7f030002;
public static final int pdf_file_password=0x7f030003;
public static final int pdf_file_select=0x7f030004;
public static final int scroll_layout=0x7f030005;
}
public static final class string {
public static final int app_name=0x7f040001;
public static final int hello=0x7f040000;
}
}
像上面的一样,在id里有的就能显示出来 调出来
还有就是 id的格式是
android:id="@+id/filename"
其中
android:id="@+id/XXX"
XXX是id的名字 注意书写方式
android:id="@+id/XXX"
上一个:有java home 还需要设置jre home么?
下一个:tomcat下的程序能访问的必要条件