Resources.Theme.ObtainStyledAttributes 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| ObtainStyledAttributes(Int32[]) |
回傳一個 TypedArray,裡面有 var<Theme>/var< 定義>的值,這些值在 <var>attrs</var> 中列出。 |
| ObtainStyledAttributes(Int32, Int32[]) |
回傳一個 TypedArray,裡面有 style resource var resid</var> 定義的值,這些值在 var<attrs>/var< 中列出>。<> |
| ObtainStyledAttributes(IAttributeSet, Int32[], Int32, Int32) |
回傳一個 TypedArray,裡面有 var<set>/var< 中>列出的屬性值,這些值在 <var>attrs</var> 中列出。 |
ObtainStyledAttributes(Int32[])
回傳一個 TypedArray,裡面有 var<Theme>/var< 定義>的值,這些值在 <var>attrs</var> 中列出。
[Android.Runtime.Register("obtainStyledAttributes", "([I)Landroid/content/res/TypedArray;", "")]
public Android.Content.Res.TypedArray ObtainStyledAttributes(int[] attrs);
[<Android.Runtime.Register("obtainStyledAttributes", "([I)Landroid/content/res/TypedArray;", "")>]
member this.ObtainStyledAttributes : int[] -> Android.Content.Res.TypedArray
參數
- attrs
- Int32[]
想要的屬性。 這些屬性 ID 必須依升序排序。
傳回
回傳一個 TypedArray,裡面包含屬性值的陣列。
完成後一定要打電話 TypedArray#recycle() TypedArray.recycle() 給我。
- 屬性
例外狀況
如果給定的 ID 不存在,則拋出 NotFoundException。
備註
回傳一個 TypedArray,裡面有 var<Theme>/var< 定義>的值,這些值在 <var>attrs</var> 中列出。
完成陣列後一定要打電話 TypedArray#recycle() TypedArray.recycle() 給我。
Java 文件 android.content.res.Resources.Theme.obtainStyledAttributes(int[])。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
另請參閱
- <xref:Android.Content.Res.Resources.ObtainAttributes(Android.Util.IAttributeSet%2c+System.Int32%5b%5d)>
- <xref:Android.Content.Res.Resources.Theme.ObtainStyledAttributes(System.Int32%2c+System.Int32%5b%5d)>
- <xref:Android.Content.Res.Resources.Theme.ObtainStyledAttributes(Android.Util.IAttributeSet%2c+System.Int32%5b%5d%2c+System.Int32%5b%5d%2c+System.Int32%5b%5d)>
適用於
ObtainStyledAttributes(Int32, Int32[])
回傳一個 TypedArray,裡面有 style resource var resid</var> 定義的值,這些值在 var<attrs>/var< 中列出>。<>
[Android.Runtime.Register("obtainStyledAttributes", "(I[I)Landroid/content/res/TypedArray;", "")]
public Android.Content.Res.TypedArray ObtainStyledAttributes(int resId, int[] attrs);
[<Android.Runtime.Register("obtainStyledAttributes", "(I[I)Landroid/content/res/TypedArray;", "")>]
member this.ObtainStyledAttributes : int * int[] -> Android.Content.Res.TypedArray
參數
- resId
- Int32
理想的風格資源。
- attrs
- Int32[]
風格中所需的特質。 這些屬性 ID 必須依升序排序。
傳回
回傳一個 TypedArray,裡面包含屬性值的陣列。
完成後一定要打電話 TypedArray#recycle() TypedArray.recycle() 給我。
- 屬性
例外狀況
如果給定的 ID 不存在,則拋出 NotFoundException。
備註
回傳一個 TypedArray,裡面有 style resource var resid</var> 定義的值,這些值在 var<attrs>/var< 中列出>。<>
完成陣列後一定要打電話 TypedArray#recycle() TypedArray.recycle() 給我。
Java 文件 android.content.res.Resources.Theme.obtainStyledAttributes(int, int[])。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
另請參閱
- <xref:Android.Content.Res.Resources.ObtainAttributes(Android.Util.IAttributeSet%2c+System.Int32%5b%5d)>
- ObtainStyledAttributes(Int32[])
- <xref:Android.Content.Res.Resources.Theme.ObtainStyledAttributes(Android.Util.IAttributeSet%2c+System.Int32%5b%5d%2c+System.Int32%5b%5d%2c+System.Int32%5b%5d)>
適用於
ObtainStyledAttributes(IAttributeSet, Int32[], Int32, Int32)
回傳一個 TypedArray,裡面有 var<set>/var< 中>列出的屬性值,這些值在 <var>attrs</var> 中列出。
[Android.Runtime.Register("obtainStyledAttributes", "(Landroid/util/AttributeSet;[III)Landroid/content/res/TypedArray;", "")]
public Android.Content.Res.TypedArray ObtainStyledAttributes(Android.Util.IAttributeSet? set, int[] attrs, int defStyleAttr, int defStyleRes);
[<Android.Runtime.Register("obtainStyledAttributes", "(Landroid/util/AttributeSet;[III)Landroid/content/res/TypedArray;", "")>]
member this.ObtainStyledAttributes : Android.Util.IAttributeSet * int[] * int * int -> Android.Content.Res.TypedArray
參數
- set
- IAttributeSet
屬性值的基礎集合。 可能是 Null。
- attrs
- Int32[]
想要取得的屬性。 這些屬性 ID 必須依升序排序。
- defStyleAttr
- Int32
目前主題中的一個屬性,包含對提供 TypedArray 預設值的樣式資源的參考。 可以是0,不用找預設值。
- defStyleRes
- Int32
一個樣式資源的資源識別碼,提供 TypedArray 的預設值,僅在 defStyleAttr 為 0 或無法在主題中找到時使用。 可以是0,不用找預設值。
傳回
回傳一個 TypedArray,裡面包含屬性值的陣列。
完成後一定要打電話 TypedArray#recycle() TypedArray.recycle() 給我。
- 屬性
備註
回傳一個 TypedArray,裡面有 var<set>/var< 中>列出的屬性值,這些值在 <var>attrs</var> 中列出。 此外,若給定的 AttributeSet 指定了風格類別(透過「style」屬性),該樣式會套用在其定義的基礎屬性之上。
完成陣列後一定要打電話 TypedArray#recycle() TypedArray.recycle() 給我。
在決定特定屬性的最終值時,有四個輸入因素會介入:
<ol><li> 給定屬性集合中的任何屬性值。 <li> 屬性集中指定的樣式資源(命名為「style」)。 <li> 由 var>defStyleAttr</var> 和 <var>defStyleRes</var><li> 指定<的預設風格 此主題的基礎值。 </ol>
這些輸入皆視為依序輸入,首列優先於後續輸入。 換句話說,如果你提供的屬性集<Button textColor="#ff000000">是 ,那麼按鈕的文字永遠都是<<>>黑色,不管任何樣式中有什麼設定。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
另請參閱
- <xref:Android.Content.Res.Resources.ObtainAttributes(Android.Util.IAttributeSet%2c+System.Int32%5b%5d)>
- ObtainStyledAttributes(Int32[])
- <xref:Android.Content.Res.Resources.Theme.ObtainStyledAttributes(System.Int32%2c+System.Int32%5b%5d)>