다음을 통해 공유


Resources.GetDrawable 메서드

정의

오버로드

GetDrawable(Int32)

특정 리소스 ID와 연결된 그리기 가능한 개체를 반환합니다.

GetDrawable(Int32, Resources+Theme)

특정 리소스 ID와 연결된 그리기 가능한 개체를 반환합니다.

GetDrawable(Int32)

특정 리소스 ID와 연결된 그리기 가능한 개체를 반환합니다.

[Android.Runtime.Register("getDrawable", "(I)Landroid/graphics/drawable/Drawable;", "GetGetDrawable_IHandler")]
public virtual Android.Graphics.Drawables.Drawable? GetDrawable (int id);
[<Android.Runtime.Register("getDrawable", "(I)Landroid/graphics/drawable/Drawable;", "GetGetDrawable_IHandler")>]
abstract member GetDrawable : int -> Android.Graphics.Drawables.Drawable
override this.GetDrawable : int -> Android.Graphics.Drawables.Drawable

매개 변수

id
Int32

aapt 도구에서 생성된 원하는 리소스 식별자입니다. 이 정수는 패키지, 형식 및 리소스 항목을 인코딩합니다. 값 0이 잘못된 식별자입니다.

반환

Drawable 이 리소스를 그리는 데 사용할 수 있는 개체입니다.

특성

예외

지정된 ID가 없으면 NotFoundException을 throw합니다.

설명

특정 리소스 ID와 연결된 그리기 가능한 개체를 반환합니다. 기본 리소스(예: 단색, PNG 이미지, 확장 가능한 이미지 등)에 따라 다양한 유형의 개체가 반환됩니다. Drawable API는 이러한 구현 세부 정보를 숨깁니다.

<p class="note"><strong>Note:</strong> 이전 android.os.Build.VERSION_CODES#JELLY_BEAN의 경우 이 함수는 여기에 전달된 리소스 ID가 다른 Drawable 리소스에 대한 별칭일 때 최종 구성 밀도를 올바르게 검색하지 못했습니다. 즉, 별칭 리소스의 밀도 구성이 실제 리소스와 다르면 반환된 Drawable의 밀도가 잘못되어 크기가 잘못되었습니다. 이 문제를 해결하려면 대신 별칭 참조를 사용하고 #getValue(int, TypedValue, boolean) 전달 trueresolveRefs하여 수동으로 확인할 수 있습니다. 결과 TypedValue#resourceId 값이 이 메서드에 전달될 수 있습니다.</p>

<p class="note"><strong>Note:</strong> 테마 그리기를 가져오려면 원하는 테마를 사용 android.content.Context#getDrawable(int) Context.getDrawable(int) 하거나 #getDrawable(int, Theme) 전달합니다.</p>

이 멤버는 더 이상 사용되지 않습니다. 대신 #getDrawable(int, Theme)를 사용하세요.

에 대한 android.content.res.Resources.getDrawable(int)Java 설명서

이 페이지의 일부는 Android 오픈 소스 프로젝트에서 만들고 공유하고 Creative Commons 2.5 특성 라이선스에 설명된 용어에 따라 사용되는 작업을 기반으로 하는 수정 사항입니다.

추가 정보

  • <xref:Android.Content.Res.Resources.GetDrawable(System.Int32%2c+.Theme)>

적용 대상

GetDrawable(Int32, Resources+Theme)

특정 리소스 ID와 연결된 그리기 가능한 개체를 반환합니다.

[Android.Runtime.Register("getDrawable", "(ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;", "GetGetDrawable_ILandroid_content_res_Resources_Theme_Handler")]
public virtual Android.Graphics.Drawables.Drawable? GetDrawable (int id, Android.Content.Res.Resources.Theme? theme);
[<Android.Runtime.Register("getDrawable", "(ILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;", "GetGetDrawable_ILandroid_content_res_Resources_Theme_Handler")>]
abstract member GetDrawable : int * Android.Content.Res.Resources.Theme -> Android.Graphics.Drawables.Drawable
override this.GetDrawable : int * Android.Content.Res.Resources.Theme -> Android.Graphics.Drawables.Drawable

매개 변수

id
Int32

aapt 도구에서 생성된 원하는 리소스 식별자입니다. 이 정수는 패키지, 형식 및 리소스 항목을 인코딩합니다. 값 0이 잘못된 식별자입니다.

theme
Resources.Theme

그리기 가능한 특성의 스타일을 지정하는 데 사용되는 테마는 다음과 입니다 null.

반환

Drawable 이 리소스를 그리는 데 사용할 수 있는 개체입니다.

특성

예외

지정된 ID가 없으면 NotFoundException을 throw합니다.

설명

에 대한 android.content.res.Resources.getDrawable(int)Java 설명서

이 페이지의 일부는 Android 오픈 소스 프로젝트에서 만들고 공유하고 Creative Commons 2.5 특성 라이선스에 설명된 용어에 따라 사용되는 작업을 기반으로 하는 수정 사항입니다.

적용 대상