Mik*_*823 21 android compiler-errors
我目前正在使用Android Studio(Beta)0.8.6,当我尝试将应用程序运行到我的设备时,出现以下错误:
error: cannot find symbol class ActionBarActivity
Run Code Online (Sandbox Code Playgroud)
我查找了此错误的解决方案,并找到以下内容: 链接
不幸的是,我不是在Eclipse之下.
我尝试运行的代码如下:
package com.example.doblevxv5.sunny;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
/**
* Created by Doble Vx V5 on 8/11/14.
*/
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new ForecastFragment())
.commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.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();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在运行API 17. Android 4.1.2你有什么建议吗?
谢谢!
| 归档时间: |
|
| 查看次数: |
24504 次 |
| 最近记录: |