본문 바로가기

Android/XML : Layout

R.styleable


R.styleable 은
res/values/attrs.xml
에서 참조할 수 있다.

그리고 아래와 같이 사용

Create a file called attrs.xml and place the following in it:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="default_gallery">
        <attr name="android:galleryItemBackground" />
    </declare-styleable>
</resources>


Then replace the code in ImageAdapter with the following:

    TypedArray a = obtainStyledAttributes
(R.styleable.default_gallery);
    mGalleryItemBackground = a.getResourceId(
        R.styleable.default_gallery_android_galleryItemBackground, 0);