Zapoznaj się nowy pasek narzędzi na klasy biblioteki wsparcie w Lollipop aktualizować można zaprojektować actionbar dodając pasek w układzie
dodać te przedmioty w y Nasza aplikacja motyw
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
Załóż pasek w układzie oraz swój TextView w centrum zaprojektować Pasek
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/acbarcolor">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/app_name"
android:textColor="#ffffff"
android:textStyle="bold" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
dodać pasek działań w pasku narzędziowym
toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
upewnij się, że należy dodać pasek narzędzi do pliku zasobów, takiego jak ten:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/toolbar" />
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:layout_width="match_parent"
android:layout_height="match_parent"
layout="@layout/homepageinc" />
</FrameLayout>
<fragment
android:id="@+id/fragment1"
android:layout_gravity="start"
android:name="com.shouldeye.homepages.HomeFragment"
android:layout_width="250dp"
android:layout_height="match_parent" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
Próbujesz mimmick iOS projekt na Androida? Ponieważ tak naprawdę nie powinieneś :) – REJH