語言

Resources.OpenRawResource 方法

定義

多載

名稱 Description
OpenRawResource(Int32)

開啟資料串流來讀取原始資源。

OpenRawResource(Int32, TypedValue)

開啟資料串流來讀取原始資源。

OpenRawResource(Int32)

開啟資料串流來讀取原始資源。

[Android.Runtime.Register("openRawResource", "(I)Ljava/io/InputStream;", "GetOpenRawResource_IHandler")]
public virtual System.IO.Stream OpenRawResource(int id);
[<Android.Runtime.Register("openRawResource", "(I)Ljava/io/InputStream;", "GetOpenRawResource_IHandler")>]
abstract member OpenRawResource : int -> System.IO.Stream
override this.OpenRawResource : int -> System.IO.Stream

參數

id
Int32

開啟的資源識別碼,由 aapt 工具產生。

傳回

InputStream 存取資源資料。

屬性

例外狀況

如果給定的 ID 不存在,則拋出 NotFoundException。

備註

開啟資料串流來讀取原始資源。 這只能用於資產檔案名稱的資源——也就是說,可以用來開啟可繪製、聲音和原始資源;它會在線材和色彩資源上失敗。

Java 文件 android.content.res.Resources.openRawResource(int)。

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

適用於

OpenRawResource(Int32, TypedValue)

開啟資料串流來讀取原始資源。

[Android.Runtime.Register("openRawResource", "(ILandroid/util/TypedValue;)Ljava/io/InputStream;", "GetOpenRawResource_ILandroid_util_TypedValue_Handler")]
public virtual System.IO.Stream OpenRawResource(int id, Android.Util.TypedValue? value);
[<Android.Runtime.Register("openRawResource", "(ILandroid/util/TypedValue;)Ljava/io/InputStream;", "GetOpenRawResource_ILandroid_util_TypedValue_Handler")>]
abstract member OpenRawResource : int * Android.Util.TypedValue -> System.IO.Stream
override this.OpenRawResource : int * Android.Util.TypedValue -> System.IO.Stream

參數

id
Int32

開啟的資源識別碼,由 aapt 工具產生。

value
TypedValue

TypedValue 物件用來儲存資源資訊。

傳回

InputStream 存取資源資料。

屬性

例外狀況

如果給定的 ID 不存在,則拋出 NotFoundException。

備註

開啟資料串流來讀取原始資源。 這只能用於資產檔案名稱的資源——也就是說,可以用來開啟可繪製、聲音和原始資源;它會在線材和色彩資源上失敗。

Java 文件 android.content.res.Resources.openRawResource(int, android.util.TypedValue)。

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

適用於