setDisplayHomeAsUpEnabled显示箭头而不是左插入符号

Sam*_*Sam 3 android

我想在我的活动中显示一个向上按钮,功能正常,但我无法显示左侧插入符号.相反,它显示了一个丑陋的后箭头.我在我的活动中这样做 -

public class SecondActivity extends ActionBarActivity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);
    setTitle(getString(R.string.second));
    mToolbar.setTitleTextColor(getResources().getColor(android.R.color.white));

    ....
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    ....

   }
}
Run Code Online (Sandbox Code Playgroud)

但我只看到这个 -

后箭头

这是布局xml -

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="org.step.main.SecondActivity">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/listsecond"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingTop="?attr/actionBarSize"
        android:clipToPadding="false"
        tools:context=".SecondActivity"
        />

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

</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

有什么建议?另外,有没有办法改变后退按钮的颜色是白色的?

注意:我正在使用主题 - Theme.AppCompat.Light.NoActionBar

Dan*_*ent 10

根据此答案,您可以将任何图标显示为白色.

至于左克拉图标,请查看此答案,其中描述了您需要下载的操作栏图标包中的位置.

编辑:您想要的图标位于 Action Bar Icons/holo_dark/02_navigation_previous_item/

要显示左箭头白色,您可以这样做:

    mToolbar.setTitleTextColor(getResources().getColor(android.R.color.white));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    //Add the following code to make the up arrow white:
    final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
    upArrow.setColorFilter(getResources().getColor(android.R.color.white), PorterDuff.Mode.SRC_ATOP);
    getSupportActionBar().setHomeAsUpIndicator(upArrow);
Run Code Online (Sandbox Code Playgroud)

请注意,您需要添加以下导入:

import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
Run Code Online (Sandbox Code Playgroud)