共用方式為


View.SetBackgroundResource(Int32) Method

Definition

Set the background to a given resource.

[Android.Runtime.Register("setBackgroundResource", "(I)V", "GetSetBackgroundResource_IHandler")]
public virtual void SetBackgroundResource (int resid);
[<Android.Runtime.Register("setBackgroundResource", "(I)V", "GetSetBackgroundResource_IHandler")>]
abstract member SetBackgroundResource : int -> unit
override this.SetBackgroundResource : int -> unit

Parameters

resid
Int32

The identifier of the resource.

Attributes

Remarks

Set the background to a given resource. The resource should refer to a Drawable object or 0 to remove the background.

Java documentation for android.view.View.setBackgroundResource(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