它顯示了這個錯誤;預計! 錯誤在哪裏?請指導我,我對它很感興趣! 不知道它的錯在哪裏... 另外它說非法開始表達!你可以幫我解決我在運行應用程序時遇到的代碼錯誤嗎?
這可能是愚蠢的。但是,我收到一個錯誤:「error:';'預計試圖建立下面的代碼的時候,我無法搞清楚。可能有人請有助於理清這個問題?
提前感謝!
package com.sv.app;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
{
@Override
public void onClick(View view;)
{
Snackbar.make(view, "Replace with your own action",
Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
你有'onCreate'內的隨機'onClick' - 這是導致錯誤。 –