Window.FindViewById Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
FindViewById(Int32) |
Finds a view that was identified by the |
FindViewById<T>(Int32) |
FindViewById(Int32)
Finds a view that was identified by the android:id
XML attribute
that was processed in android.app.Activity#onCreate
.
[Android.Runtime.Register("findViewById", "(I)Landroid/view/View;", "GetFindViewById_IHandler")]
public virtual Android.Views.View? FindViewById (int id);
[<Android.Runtime.Register("findViewById", "(I)Landroid/view/View;", "GetFindViewById_IHandler")>]
abstract member FindViewById : int -> Android.Views.View
override this.FindViewById : int -> Android.Views.View
Parameters
- id
- Int32
the ID to search for
Returns
a view with given ID if found, or null
otherwise
- Attributes
Remarks
Finds a view that was identified by the android:id
XML attribute that was processed in android.app.Activity#onCreate
.
This will implicitly call #getDecorView
with all of the associated side-effects.
<strong>Note:</strong> In most cases -- depending on compiler support -- the resulting view is automatically cast to the target class type. If the target class type is unconstrained, an explicit cast may be necessary.
Java documentation for android.view.Window.findViewById(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
FindViewById<T>(Int32)
public T? FindViewById<T> (int id) where T : Android.Views.View;
member this.FindViewById : int -> 'T (requires 'T :> Android.Views.View)
Type Parameters
- T
Parameters
- id
- Int32
Returns
Remarks
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.