Formatter.FormatFileSize(Context, Int64) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將內容大小格式化為位元組、千位元組、兆位元組等。
[Android.Runtime.Register("formatFileSize", "(Landroid/content/Context;J)Ljava/lang/String;", "")]
public static string? FormatFileSize(Android.Content.Context? context, long sizeBytes);
[<Android.Runtime.Register("formatFileSize", "(Landroid/content/Context;J)Ljava/lang/String;", "")>]
static member FormatFileSize : Android.Content.Context * int64 -> string
參數
- context
- Context
載入本地單位的上下文
- sizeBytes
- Int64
需要格式化的大小值,以位元組為單位
傳回
格式化字串,編號為
- 屬性
備註
將內容大小格式化為位元組、千位元組、兆位元組等。
自 O 起,前綴在 SI 系統中以標準意義使用,例如 kB = 1000 位元組,MB = 1,000,000 位元組等。
在 android.os.Build.VERSION_CODES#N 早期及之前,則改用 1024 的冪次方,KB = 1024 位元組,MB = 1,048,576 位元組,依此類推。
如果上下文是從右到左的區域,回傳的字串會用 bidi 格式化字元包裹,以確保插入在右至左字串中時能正確顯示。 (這在單位字串如「MB」是從左到右,但區域為右至左的情況非常有用。)
Java 文件 android.text.format.Formatter.formatFileSize(android.content.Context, long)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。