How to consume reusable gui element/widget with resources in android

前端 未结 1 1613
谎友^
谎友^ 2020-12-12 04:02

I try to use the dateslider in my android project to have a combined date-time picker im my gui.

The authors of the widget suggest to include the java- and resource

1条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-12 04:51

    Is there a way to have 2 resource-sets with different namespaces so that there are my.namespace.myApp.R.xxx and com.googlecode.android.widgets.DateSlider.R in the main app?

    No, sorry.

    Note: Android: How do I create reusable components? does not help because it tells you how to create library-projects.

    However, that is the right answer. Download the full project from their repo, import it into Eclipse, and mark it as a library project (Properties > Android). Then, add it as a library project to your app's project.

    Eventually (which now appears like it will be the R18 version of tools or later), the tools should support packaging reusable components in a JAR, with resources, in such a manner that you can add them to a host project and the resources will be blended in automatically. Right now, that's not an option.

    0 讨论(0)
提交回复
热议问题