簡體   English   中英

android 我想要這樣的操作欄

[英]android I want action bar like this

我想制作這樣的動作條..

在此處輸入圖片說明

請幫助我這樣做我試着喜歡這個但我無法得到它請幫助我完成教程。我是 android 新手。 這是Activity代碼

    public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);
    }
}

編輯:

另請參閱此鏈接

github上看到這個 Demo

從那個使用toolbar布局並復制styles.xml

樣式文件

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.MyTheme">
        <!-- Customize your theme here. -->
    </style>
    <style name="Theme.MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- customize the color palette -->
        <item name="colorPrimary">@color/color_primary</item>
        <item name="colorPrimaryDark">@color/color_primary_dark</item>
        <item name="colorAccent">@color/color_accent</item>
    </style>
</resources>

工具欄.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:elevation="4dp"
    android:id="@+id/tool_bar"
    android:theme="@style/ThemeOverlay.AppCompat.Dark"
    android:background="?attr/colorPrimary"
    android:layout_height="?attr/actionBarSize">

</android.support.v7.widget.Toolbar>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM