語言

Activity.FindViewById 方法

定義

多載

名稱 Description
FindViewById(Int32)

找到一個由 android:id XML 屬性識別的檢視,該屬性在 #onCreate中被處理。

FindViewById<T>(Int32)

從 XML 版面資源中尋找由 id 屬性識別的視圖。

FindViewById(Int32)

找到一個由 android:id XML 屬性識別的檢視,該屬性在 #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

參數

id
Int32

搜尋的 ID

傳回

若找到,則需取得指定 ID 的視角,或其他 null 方式

屬性

備註

找到一個由 android:id XML 屬性識別的視圖,該屬性在 onCreate(Bundle) 中處理過。 注意:在大多數情況下——視編譯器支援而定——產生的視圖會自動投射成目標類別類型。 若目標類別類型不受限制,則可能需要明確施放。

另請參閱:

Android 參考資料。android.app.Activity.findViewById

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於

FindViewById<T>(Int32)

從 XML 版面資源中尋找由 id 屬性識別的視圖。

public T? FindViewById<T>(int id) where T : Android.Views.View;
member this.FindViewById : int -> 'T (requires 'T :> Android.Views.View)

類型參數

T

參數

id
Int32

傳回

T

備註

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於