【发布时间】:2014-03-09 14:41:02
【问题描述】:
1> 当我添加 google play services 库时,它显示 green right 标记,但是当我按下 ok 并重新打开项目属性时,它显示 red cross 标记。
2> 在 Eclipse 中,当我创建新的 android 项目时,默认情况下会创建 ActionBarActivity 安装的 Activity。为什么?
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 PlaceholderFragment()).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;
}
【问题讨论】:
-
ActionBarActivity 来自 AppCompat 兼容性库。 developer.android.com/tools/support-library/features.html
-
shkschneider 感谢您的回复。如何将其恢复为 Activity ?你知道问题 1 吗?
-
2.为什么要取消兼容性? 1.请发截图
-
对于 1. 确保库路径正确。图书馆实际上就在那里。如果你没有正确引用图书馆,你会得到一个红十字
标签: android eclipse google-play-services