我可以写在android的XML布局或字符串值的java文件code? [英] Can I write java code in android xml layout or string values files?

查看:132
本文介绍了我可以写在android的XML布局或字符串值的java文件code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有可能写java code Android中的XML结构或字符串值的文件?

I want to know if it is possible to write java code in android XML layout or string values files?

我的意思是这样的:


<string name="hello">Utilities.doSomething("Hello World, ActMain!")</string>
<string name="app_name">insurance</string>

推荐答案

从strings.xml中运行code可以通过以下方式成为可能(未测试,但这样做高水平的想法吧)
1.Get使用R.string strings.xml中的字符串。*,其中*是您的字符串的名称

Running code from strings.xml can be possible in the following way(Not tested,but a high level idea of doing it) 1.Get the string from strings.xml using R.string.* where * is the name of your string.

2,使用任何除权pressions评价库来运行它。

2.Use any of the expressions evaluation library to run it.

同样这是一个非常高的水平idea.You必须弄清楚如何做到这一点你的自我。

Again this a very high level idea.You will have to figure out how to do that your self.

检查JEL库它

或检查评估文库的这个列表

这篇关于我可以写在android的XML布局或字符串值的java文件code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆