Android - More elegant way of declaring customs components in XML files

169 views Asked by At

Currently I have a class called CustomizedGallery that extends the default Gallery. I include it in my XML layout files like this:

      <RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_marginLeft="80px"
    android:layout_marginTop="0px"
    android:layout_width="869px"
    android:layout_height="605px"
    android:background="#000000"
    android:orientation="horizontal" >

    <com.my.path.here.CustomizedGallery
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="864px"
        android:layout_height="600px"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:id="@+id/gallery" />
</RelativeLayout>

The problem is that, every time I change my package name (com.my.path.here), I have to manually edit the XMLs as well (because they don't get updated as the .java files). Is there a way that I can include my custum gallery class in the XML such as I don't need to edit the package name every time in the XMLs that use my custom class??

PS: You might wonder why the heck I change the package names so often. The reason is because I build very similar apps for the same client, so, I need to change the package name every time so the slightly modified app can be installed in the same device.

Thank you in advance!

0

There are 0 answers