Android 基于自定义属性的buildType的命名空间
对于调试和发布构建类型,我有单独的包名。从Android文档中,我们知道定制属性可以通过提供名称空间在XML布局中使用。名称空间看起来像:Android 基于自定义属性的buildType的命名空间,android,android-studio,android-layout,xamarin,android-xml,Android,Android Studio,Android Layout,Xamarin,Android Xml,对于调试和发布构建类型,我有单独的包名。从Android文档中,我们知道定制属性可以通过提供名称空间在XML布局中使用。名称空间看起来像:http://schemas.android.com/apk/res/[您的软件包名称]: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/
http://schemas.android.com/apk/res/[您的软件包名称]
:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res/[your package name]">
<com.example.customviews.charting.PieChart
custom:showText="true"
custom:labelPosition="left" />
</LinearLayout>
基于buildType,如何构造名称空间以使其引用当前包名?它可能是Strings.xml res中定义的字符串,然后这个布局从那里引用它吗?可以基于当前包名动态创建名称空间吗?您可以尝试通过Android>Properties>Android Manifest>package name构建名称空间。@WendyZang MSFT您能详细说明一下吗?我不知道你的意思。感谢我上面提到的更改名称空间的包名的方法。