首先,我在Stackoverflow上搜索并看到了类似的问题,但是我在Android工作室或Eclipse之外构建,所以我的有点不同,如果可能的话,我正在寻找解决方案或替代方案。 我正在构建一个使用Cordova在Java和Javascript之间发送消息的插件。
我有3行要解决:
setContentView(R.layout.main);
mPreview = (CameraSourcePreview) findViewById(R.id.preview);
mGraphicOverlay = (GraphicOverlay) findViewById(R.id.faceOverlay);
特别是setContentView(R.layout.main)
,findViewById(R.id.preview)
和findViewById(R.id.faceOverlay)
。布局文件位于../../../res/layout/main.xml
和../../../res/layout-land/main.xml
。
我想要的只是一种访问方式,我没有R.java
文件,而且我对Java不是很有经验,不像Javascript。
有没有办法指出这些文件,谢谢。
main.xml中:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/topLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">
<com.cordovaplugincamerapreview
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.cordovaplugincamerapreview
android:id="@+id/faceOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.cordovaplugincamerapreview>
</LinearLayout>