我有“项目库”和“主应用程序”,用户组件来自“项目库”。 我想从“主应用程序”中的“项目库”中查看。 “主要应用”的代码是:
package xliiv.sandbox;
import xliiv.sandbox.library.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class MyProjectMainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv = (TextView) findViewById(xliiv.sandbox.library.R.??);
}
}
Eclipse没有提示任何id,与R之类的其他项目相反(layout,drawable,string,..)。 我手动检查xliiv.sandbox.library.R(来自我的'项目库'的文件):
/* 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.
*/
package xliiv.sandbox.library;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int tv=0x7f050000;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040001;
public static final int hello=0x7f040000;
}
}
所以... xliiv.sandbox.library.R(来自'项目库')肯定包含xliiv.sandbox.library.R.id ..., 但我的'主应用'中的xliiv.sandbox.library.R不是