共用方式為


Toolbar.SetNavigationIcon(Int32) Method

Definition

Set the icon to use for the toolbar's navigation button.

[Android.Runtime.Register("setNavigationIcon", "(I)V", "GetSetNavigationIcon_IHandler")]
public virtual void SetNavigationIcon (int resId);
[<Android.Runtime.Register("setNavigationIcon", "(I)V", "GetSetNavigationIcon_IHandler")>]
abstract member SetNavigationIcon : int -> unit
override this.SetNavigationIcon : int -> unit

Parameters

resId
Int32

Resource ID of a drawable to set

Attributes

Remarks

Set the icon to use for the toolbar's navigation button.

The navigation button appears at the start of the toolbar if present. Setting an icon will make the navigation button visible.

If you use a navigation icon you should also set a description for its action using #setNavigationContentDescription(int). This is used for accessibility and tooltips.

Java documentation for android.widget.Toolbar.setNavigationIcon(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to