Ich folgte dieser tutorial, um meiner App eine normale Symbolleiste mit einigen Registerkarten zu geben.Fügen Sie ein benutzerdefiniertes Layout zur Symbolleiste hinzu
Ich möchte die Symbolleiste ändern, damit es mehr wie folgt aussieht:
ich einige Texte und Bilder in die Symbolleiste hinzufügen möchten. Wie kann ich das machen?
activity_main.xml
:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/primary"
app:layout_scrollFlags="scroll|enterAlways"
app:theme="@style/ToolbarTheme"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
/>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabTextAppearance="@style/TabLayout"
app:tabSelectedTextColor="@color/white"
/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
</android.support.design.widget.CoordinatorLayout>
das ist eine einzeilige Symbolleiste, andere Informationen sind nur lineare Layouts mit der gleichen Hintergrundfarbe. Sie können auch eine Ansicht innerhalb der Symbolleiste hinzufügen, fügen Sie einfach ein schließendes Tag ' android.support.v7.widget.Toolbar>' –
NaviRamyle
hinzu Wenn ich das Layout innerhalb der Toolbar Tags hinzufügen, ändert sich das Verhalten? Was ist, wenn die Toolbar 500 Pixel groß ist? – user5374735
indirektes Duplikat von [Der beste Weg, um eine untere Symbolleiste in Android zu erstellen.] (Http://stackoverflow.com/questions/30063426/best-way-to-create-a-bottom-toolbar-in-android) – Elltz