下一个视图id作为android中的自定义属性(Next view id as a custom attribute in android)
对于我的自定义视图,我还定义了一个自定义属性来保持视图的id。 它的格式是“参考”。
在布局xml中,它定义如下,与
android:layout_below
attr非常相似<mycustomview id="@+id/cv_1" xyz:nextviewId="@id/cv_2"... /> <mycustomview id="@+id/cv_2" xyz:nextviewId="@id/cv_3"... /> ... <LinearLayout ...> <mycustomview id="@+id/cv_3" xyz:nextviewId="@id/cv_4"... /> </LinearLayout> ...
它给了我错误我认为这是因为它尚未宣布。
有关访问下一个对象的任何建议类似于这种方法!
我正在考虑使用tag attr为下一个对象找到具有findByTag函数的下一个对象。 这是一个很好的方法吗?
非常感谢。
For my custom view I have also defined a custom attribute for keep id of the view. Its format is "reference".
in layout xml it is defined like below, very similar with
android:layout_below
attr<mycustomview id="@+id/cv_1" xyz:nextviewId="@id/cv_2"... /> <mycustomview id="@+id/cv_2" xyz:nextviewId="@id/cv_3"... /> ... <LinearLayout ...> <mycustomview id="@+id/cv_3" xyz:nextviewId="@id/cv_4"... /> </LinearLayout> ...
it gives me error I think it is because it is not declared yet.
Any suggestion for accessing the next object similar to this approach!!!
I am thinking to use tag attr for the next object find the next one with findByTag function. Is this a good way to do it.
Thanks a lot.
原文:https://stackoverflow.com/questions/6426930
最满意答案
您可以使用仅匹配单个等号的正则表达式,并在该正则表达式上调用替换。
new Regex("={1,}").Replace("=", "==")
返回
==
new Regex("={1,}").Replace("==", "==")
返回
==
You can use a Regex which will match only a single equals sign and call Replace on that Regex.
new Regex("={1,}").Replace("=", "==")
Returns
==
new Regex("={1,}").Replace("==", "==")
Returns
==
相关问答
更多-
你可以使用一个简单的行: str = str.replaceAll("import sel\\.", "import sel.gen."); 正则表达式演示 IdeOne的例子 You can use a simple line like: str = str.replaceAll("import sel\\.", "import sel.gen."); Regex demo IdeOne example
-
postgresql - 替换文本字段中字符串的所有实例(postgresql - replace all instances of a string within text field)[2022-09-06]
你想使用postgresql的替换函数: replace(string text, from text, to text) 例如 : UPDATE