是否可以在深层链接 URI 中使用字符串常量?
目前我有几个链接,导致host部分重复:
<deepLink app:uri="www.host.com/a" />
<deepLink app:uri="www.host.com/b" />
<deepLink app:uri="www.host.com/c" />
<deepLink app:uri="www.host.com/d" />
因此,我正在寻找一种以某种方式提取 www.host.com
的方法。
我一直天真地尝试将它提取到 strings.xml
:
<string name="host">www.host.com</string>
然后:
<deepLink app:uri="{@string/host}/details/{id}" />
但这不起作用(在深度链接 URI 主机中不正确使用通配符和/或占位符
编译错误)
最佳答案
如对此问题的评论中所述 OP想在深层链接 uri 中使用常量字符串进行多次使用。名为 Entity declaration 的 XML 功能允许这样做。
也回答了具有类似目标的问题here .
https://stackoverflow.com/questions/63244073/
相关文章:
html - 网络套件 : FreeMarker/BFO Images Cutting Off at
python - Keras - 数据集的数据生成器太大而无法放入内存
reactjs - react : Fix missing dependency warning u
javascript - Firebase 和 VueJS : Uncaught (in promi
javascript - Cypress 在使用 cy.visit() 时注销
java - 使用 Spring WebClient 重复过滤响应