다음을 통해 공유


Activity.SetContentView Method

Definition

Overloads

SetContentView(View, ViewGroup+LayoutParams)

Set the activity content from a layout resource.

SetContentView(View)

Set the activity content to an explicit view.

SetContentView(Int32)

Set the activity content from a layout resource.

SetContentView(View, ViewGroup+LayoutParams)

Set the activity content from a layout resource.

[Android.Runtime.Register("setContentView", "(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V", "GetSetContentView_Landroid_view_View_Landroid_view_ViewGroup_LayoutParams_Handler")]
public virtual void SetContentView (Android.Views.View? view, Android.Views.ViewGroup.LayoutParams? params);
[<Android.Runtime.Register("setContentView", "(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V", "GetSetContentView_Landroid_view_View_Landroid_view_ViewGroup_LayoutParams_Handler")>]
abstract member SetContentView : Android.Views.View * Android.Views.ViewGroup.LayoutParams -> unit
override this.SetContentView : Android.Views.View * Android.Views.ViewGroup.LayoutParams -> unit

Parameters

view
View

The desired content to display.

params
ViewGroup.LayoutParams

Layout parameters for the view.

Attributes

Remarks

Java documentation for android.app.Activity.setContentView(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.

See also

Applies to

SetContentView(View)

Set the activity content to an explicit view.

[Android.Runtime.Register("setContentView", "(Landroid/view/View;)V", "GetSetContentView_Landroid_view_View_Handler")]
public virtual void SetContentView (Android.Views.View? view);
[<Android.Runtime.Register("setContentView", "(Landroid/view/View;)V", "GetSetContentView_Landroid_view_View_Handler")>]
abstract member SetContentView : Android.Views.View -> unit
override this.SetContentView : Android.Views.View -> unit

Parameters

view
View

The desired content to display.

Attributes

Remarks

Set the activity content to an explicit view. This view is placed directly into the activity's view hierarchy. It can itself be a complex view hierarchy. When calling this method, the layout parameters of the specified view are ignored. Both the width and the height of the view are set by default to ViewGroup.LayoutParams#MATCH_PARENT. To use your own layout parameters, invoke #setContentView(android.view.View, android.view.ViewGroup.LayoutParams) instead.

Java documentation for android.app.Activity.setContentView(android.view.View).

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.

See also

Applies to

SetContentView(Int32)

Set the activity content from a layout resource.

[Android.Runtime.Register("setContentView", "(I)V", "GetSetContentView_IHandler")]
public virtual void SetContentView (int layoutResID);
[<Android.Runtime.Register("setContentView", "(I)V", "GetSetContentView_IHandler")>]
abstract member SetContentView : int -> unit
override this.SetContentView : int -> unit

Parameters

layoutResID
Int32

Resource ID to be inflated.

Attributes

Remarks

Set the activity content from a layout resource. The resource will be inflated, adding all top-level views to the activity.

Java documentation for android.app.Activity.setContentView(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.

See also

  • SetContentView(View)
  • <xref:Android.App.Activity.SetContentView(Android.Views.View%2c+.LayoutParams)>

Applies to