Android 如何使工具栏中的箭头颜色为白色
我是新开发人员。我只是在工具栏中添加了返回箭头,但它是黑色的。我怎么把它变成白色。下面是我的代码: JavaAndroid 如何使工具栏中的箭头颜色为白色,android,Android,我是新开发人员。我只是在工具栏中添加了返回箭头,但它是黑色的。我怎么把它变成白色。下面是我的代码: Java setSupportActionBar(newToolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); XML文件 <android.support.v7.widget.Toolbar
setSupportActionBar(newToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
XML文件
<android.support.v7.widget.Toolbar
android:id="@+id/newToolBarId"
android:background="@color/colorPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.Toolbar>
我通过编辑styles.xml解决了这个问题:
<style name="ToolbarColoredBackArrow" parent="AppTheme">
<item name="android:textColorSecondary">#ffffff</item>
#ffffff
…然后在“活动”中的工具栏定义中引用样式:
<LinearLayout
android:id="@+id/main_parent_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
app:theme="@style/ToolbarColoredBackArrow"
app:popupTheme="@style/AppTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>