以下源代码应制作图片并在屏幕上显示.但我得到一些错误.Cannot resolve symbol 'activity_fullscreen'
,同样为imageView1
,dummy_button
,fullscreen_content
和fullscreen_content_controls
.
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fullscreen); mVisible = true; mControlsView = findViewById(R.id.fullscreen_content_controls); mContentView = findViewById(R.id.fullscreen_content); // Set up the user interaction to manually show or hide the system UI. mContentView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { toggle(); } }); // Upon interacting with UI controls, delay any scheduled hide() // operations to prevent the jarring behavior of controls going away // while interacting with the UI. findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener);//dummy abaendern //super.onCreate(savedInstanceState); //setContentView(R.layout.activity_fullscreen); this.imageView = (ImageView)this.findViewById(R.id.imageView1); Button photoButton = (Button) this.findViewById(R.id.dummy_button); photoButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, CAMERA_REQUEST); } }); }
那是我的进口:
import android.annotation.SuppressLint; import android.app.Activity; import android.graphics.Bitmap; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.os.Handler; import android.view.MotionEvent; import android.view.View; import android.content.Intent; import android.widget.Button; import android.widget.ImageView; import android.R;
现在让我们来看看activity_fullscreen.xml
缺少的部分肯定在那里.
我已经检查了以下答案中的建议.据我所知,名称不包含任何非法字符.我也已经通过File - > Invalidate Caches/Restart重新启动了android studio.
但我仍然没有找到解决问题的方法.如何解决R而不是其内容是否可行?欢迎任何想法.谢谢
你导入了错误的'R'
删除这个:
import android.R;
添加这个:
import com.yourCompany.yourApp.R;