Actionbar
はandroid.support.v7.widget.Toolbar
です。それはバック矢印にアニメーションのハンバーガーイメージを持っています、私は< - >から戻る矢印を変更したいです。 Android Studioでどうすればいいですか?アクションバーのappcompat-v7で戻る矢印の画像
setHomeAsUpIndicator()
メソッドで変更するのはどこか読んでいますが、ハンバーガーボタンが変わり、戻る矢印のアニメーションがありません。これを行うには
//Find the action bar for customizations
final ActionBar ab = getSupportActionBar();
assert ab != null;
//Make the action bar display an up arrow and set its drawable and color
ab.setDisplayHomeAsUpEnabled(true);
final Drawable upArrow = ResourcesCompat.getDrawable(
getResources(),
R.drawable.abc_ic_ab_back_mtrl_am_alpha, //this is the <- arrow from android resources. Change this to the thing you want.
null);
assert upArrow != null;
upArrow.setColorFilter(
ContextCompat.getColor(
getApplicationContext(),
R.color.white // change this to the color you want (or remove the setColorFilter call)
),
PorterDuff.Mode.SRC_ATOP);
ab.setHomeAsUpIndicator(upArrow);
を画像の可視化は、 –