相关疑难解决方法(0)

如何更改工具栏主页图标颜色

我正在使用android.support.v7.widget.Toolbar并从这篇文章中了解如何将汉堡包图标的颜色更改为白色,但当我调用时,向上/向后箭头仍然是深色

setDisplayHomeAsUpEnabled(true);
Run Code Online (Sandbox Code Playgroud)

我怎样才能使箭头变白?

当我调用setDisplayHomeAsUpEnabled()时,这是我的工具栏的样子:

在此输入图像描述

...这是我的styles.xml文件的相关部分:

<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">#194C5F</item>
    <item name="colorAccent">@color/accent</item>
    <item name="drawerArrowStyle">@style/WhiteDrawerIconStyle</item>
</style>

    <style name="WhiteDrawerIconStyle" parent="Widget.AppCompat.DrawerArrowToggle">
        <item name="spinBars">true</item>
        <item name="color">@android:color/white</item>
    </style>
Run Code Online (Sandbox Code Playgroud)

icons android toolbar android-support-library

99
推荐指数
11
解决办法
12万
查看次数

更新到支持库23.2.0后,前棒棒糖设备中的后箭头和溢出图标颜色错误

在Lollipop之前的设备上,升级到Support Library 23.2.0后,操作栏上的溢出菜单图标和后退按钮变为黑色.它们在升级之前是白色的(这是正确的颜色).

正确的颜色是: 在此输入图像描述

升级后,前Lollipop设备会显示错误的颜色,如溢出菜单图标所示:

在此输入图像描述

sytle.xml中的主题(pre-v21/Lollipop):

<resources xmlns:android="http://schemas.android.com/apk/res/android" >
    <!--Used on the application level by the manifest.-->
    <style name="app_theme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/app_primary_colour</item>
        <item name="colorPrimaryDark">@color/app_primary_dark_colour</item>
        <item name="colorAccent">@color/app_accent_colour</item>
        <item name="android:windowBackground">@color/app_background</item>
        <item name="searchViewStyle">@style/custom_search_view_style</item>
    </style>

    <!--Used by activities.-->
    <style name="app_theme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <!--TODO: What are these?-->
    <style name="app_theme.app_bar_overlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
    <style name="app_theme.popup_overlay" parent="ThemeOverlay.AppCompat.Light" /> ... ... </resources>
Run Code Online (Sandbox Code Playgroud)

我看过这里这里但没有解决问题.

更新:另请参阅此Google错误报告:https: //code.google.com/p/android/issues/detail?id = 201918

android android-support-library androiddesignsupport

27
推荐指数
2
解决办法
5385
查看次数

使用内部嵌套scrollview的Recyclerview?

我使用的内部回收其放在嵌套的滚动视图内的多个视图的持有人,有一个在自然行为的改变onBindViewHolder() ,因为嵌套滚动,回收器视图getItemViewType()所有项目被称为内onBindViewHolder()发起回收适配器时,例如,我有20个项目意味着在正常情况下只有三个项目在启动时调用,但是在嵌套滚动视图的情况下,所有20个视图在第一次加载时创建.

Xml文件

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_content"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/light_gray_vd">
    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:contentScrim="@color/primaryColor"
            app:expandedTitleMarginEnd="16dp"
            app:expandedTitleMarginStart="48dp"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fitsSystemWindows="true"
                app:layout_collapseMode="parallax">

                <include
                    android:id="@+id/inc_gallery"
                    layout="@layout/proj_galery_new"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content" />

            </FrameLayout>

            <View
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar1"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:layout_gravity="top"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

                <include
                    android:id="@+id/toolbar_header_view"
                    layout="@layout/header_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:visibility="gone" />
            </android.support.v7.widget.Toolbar>

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:id="@+id/vde_mv_scroll_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <FrameLayout
            android:id="@+id/rlCollapseScroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <android.support.v7.widget.RecyclerView
                android:id="@+id/view_recycler"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

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



        </FrameLayout>
    </android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

java android android-recyclerview nestedscrollview

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