我一直试图破解屏幕或布局中类型标签的所有元素,但没有成功!我的目标是翻译所有的翻译,翻译是在列表中有对(label.text,screen1.labels.text )的列表。这在App-inventor中是可能的吗?
发布于 2015-09-20 23:53:27
你有没有想过获得一个子视图的数组列表,并通过它们进行迭代。下面的代码将适用于屏幕的直接子项。如果你也需要子视图,你可以使用递归
RelativeLayout layout = (RelativeLayout)findViewById(R.id.your_screen_to_search);
for (int i = 0; i < layout.getChildCount(); i++)
{
View child = layout.getChildAt(i);
if(child instanceOf TextView)
{
txtView = (TextView)child;
if(txtView.getText().length!=0)
{
yourTranslateFunction(txtView.getText());
}
}
}https://stackoverflow.com/questions/32681128
复制相似问题