首次使用显示指标时出现错误"Link all references for a local rename (does not change references in other files)"
,以便所有ID显示为id的行都无法解析。我将放置代码。帮助我。
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
try{
emailForConfigChanges = emailTextBox.getText().toString().trim();
passwordForConfigChanges = passwordTextBox.getText().toString().trim();
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
switch(displayMetrics.densityDpi){
case DisplayMetrics.DENSITY_LOW:
setContentView(R.layout.login_small);
*showing error in the above line "Link all references for a local rename (does not change references in other files)"*
break;
default:
setContentView(R.layout.login);
}
} catch(Exception e){
e.printStackTrace();
}
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
ImageButton loginButton = (ImageButton) findViewById(R.id.loginButton);
loginButton.setOnClickListener(this);
ImageButton registerOrangeButton = (ImageButton) findViewById(R.id.registerOrangeButton);
registerOrangeButton.setOnClickListener(this);
TextView forgotPasswordText = (TextView) findViewById(R.id.forgotPasswordText);
forgotPasswordText.setOnClickListener(this);
passwordTextBox = (EditText) findViewById(R.id.passwordLogin);
passwordTextBox.setText(passwordForConfigChanges);
passwordTextBox.setOnKeyListener(this);
emailTextBox = (EditText) findViewById(R.id.emailLogin);
emailTextBox.setText(emailForConfigChanges);
emailTextBox.setOnKeyListener(this);
答案 0 :(得分:4)
请检查导入部分
如果这一行 - > “import android.R;”存在你应该删除