Alguém pode me explicar declarar XML tag-styleable neste exemplo e a teoria por trás de seu uso?

Estou lendo Beginning Android 4 Development e no capítulo 5 fala sobreGaleria eImageVievs e introduz odeclarar-estilizável Tag XML sem explicar o seu propósito .. Tentei achar alguma informação também sobre a referência, sem sorte .. Por exemplo temos o seguinte:

res / values ​​/ attrs.xml

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

example.java

public class GalleryActivity extends Activity {
[...]
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState);    
        setContentView(R.layout.main);
        Gallery gallery = (Gallery) findViewById(R.id.gallery1);
        gallery.setAdapter(new ImageAdapter(this)); 
        [...]
    }

    [...]

    public class ImageAdapter extends BaseAdapter {
        [...]
        int itemBackground;

        public ImageAdapter(Context c) {
            context = c;
            //---setting the style---
            TypedArray a = obtainStyledAttributes(
            R.styleable.Gallery1); 
            itemBackground = a.getResourceId(
                        R.styleable.Gallery1_android_galleryItemBackground, 0);
            a.recycle();
        }

        public View getView(int position, View convertView, ViewGroup parent) {
            ImageView imageView;
            [...]
            imageView.setBackgroundResource(itemBackground);
            return imageView; 
        }
    }
}

Eu li o código algumas vezes e eu realmente não entendo o propósito de definir este estilizávelGallery1 com um únicoatrito criança apenas com umnome atributo .. você pode me ajudar? É istogalleryItemBackground algo fornecido pelo sistema ou é algo definido por nós? O que estamos fazendo neste pedaço de código?

Obrigado desde já por qualquer ajuda!

questionAnswers(1)

yourAnswerToTheQuestion