如何在 Eclipse 中使用工具栏?

How to use Toolbar in Eclipse?

我想在我的应用程序中使用工具栏(使用 Eclipse IDE 创建)并在所有活动中使用此工具栏。

我认为这段代码可以工作:

<LinearLayout 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:fitsSystemWindows="true"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
  android:id="@+id/toolbar"
  android:minHeight="?attr/actionBarSize"  
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  app:titleTextColor="@android:color/white"
  android:background="?attr/colorPrimary">
</android.support.v7.widget.Toolbar>

<!-- Layout for content is here. This can be a RelativeLayout  -->


但我对用法一无所知

抱歉英语不好,我是伊朗人。

感谢您的帮助。

在所有活动的每个 layout.xml 中包含工具栏。

举个例子:

<LinearLayout
        ...>

    <Toolbar
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

    ...

</LinearLayout>