Benutzer dies in Ihrem xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<FrameLayout
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
und dann in der Tätigkeit onCreate(); dieses Add
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_toolbar);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("YOUR_TITLE");
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
Diese Linie wird auf den Pfeil an der linken Ecke der Symbolleiste
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Besuchen Sie diesen Link hinzufügen: http://stackoverflow.com/questions/40960334/action-bar-with- back-arrow/40960576 # 40960576 –
Sie können 'ToolBar' als Kopfzeile verwenden und wenn Sie das Symbol 'Drawable' verwenden möchten. In Android Studio: Gehe zu 'Datei/Neu/Vektor Asset/Icon'. Klicken Sie auf das Symbol und wählen Sie das gewünschte Symbol aus. Verwenden Sie das Symbol "Require" anstelle des Symbols "Zurück". –