【发布时间】:2015-08-09 13:28:18
【问题描述】:
我正在替换 ActionBar 并将 Material Design ToolBar 集成到我的应用程序中。我的一项活动扩展了ListActivity。
在onCreate() 方法中,每当我尝试添加ToolBar 时,setSupportActionBar() 方法都会产生错误,指出无法解析。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.activity_route_recipients);
// Attaching the toolbar layout to the toolbar object
toolbar = (Toolbar) findViewById(R.id.tool_bar);
// Setting toolbar as the ActionBar with setSupportActionBar() call
setSupportActionBar(toolbar);
// get the default list view associated with this activity
getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); // we can now check and uncheck multiple friends
// get the array of LatLng points passed in from the map intent
markerPoints = getIntent().getParcelableArrayListExtra("markerPoints");
}
这个问题的最佳解决方案是什么?
【问题讨论】:
-
您遇到了什么错误?
标签: java android android-studio material-design android-toolbar