在解决了之前的问题(Getting 'The method setSupportActionBar(Toolbar) in type AppCompatActivity is not applicable for the arguments (Toolbar)' in my AppCompatActivity)之后,现在 setSupportActionBar() 正在崩溃。同样,这里是相关代码:
import android.support.v7.widget.Toolbar;
public class FivetoGo extends AppCompatActivity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
.
.
.
和布局:
<?xml version='1.0' encoding='UTF-8' ?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ff6d7fe2"
android:minHeight="?android:attr/actionBarSize"
app:contentInsetEnd="0dp"
app:contentInsetStart="0dp" >
</android.support.v7.widget.Toolbar>
.
.
.
</RelativeLayout>