小编Ake*_*kef的帖子

如何更改工具栏颜色

我一直在搜索如何自定义工具栏,例如如何添加背景颜色,但我不明白它是如何工作的.

我一直在尝试为我的工具栏添加自定义样式,但任何结果......

清单

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.Design">
Run Code Online (Sandbox Code Playgroud)

style.xml文件

<resources>

    <style name="Theme.Design" parent="Base.Theme.Design">
    </style>

    <style name="Base.Theme.Design" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/red</item>
        <item name="colorPrimaryDark">@color/red</item>
        <item name="colorAccent">@color/red</item>
        <item name="android:textColorPrimary">@color/white</item>
        <item name="android:windowActionBarOverlay">true</item>
        <item name="windowActionBarOverlay">true</item>
    </style>    
    ...
Run Code Online (Sandbox Code Playgroud)

和布局中的工具栏

<android.support.v7.widget.Toolbar
            android:id="@+id/home_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"/>
Run Code Online (Sandbox Code Playgroud)

android toolbar

10
推荐指数
4
解决办法
4万
查看次数

ZXing找到二维码后如何重启相机

当 Zxing 发现二维码时,它会将其发送到handleResult功能并停止相机。如果解码后的二维码已保存在我的应用程序中,我需要重新启动相机。如何重新启动相机?

android zxing

1
推荐指数
1
解决办法
1345
查看次数

标签 统计

android ×2

toolbar ×1

zxing ×1