English 中文(简体)
文本视图后编辑文本时, 机器人 XML 失效
原标题:Android XML Fails when EditText after Textview
  • 时间:2012-05-22 11:23:26
  •  标签:
  • android
  • xml

我正在获取错误 TextView 不能被投到编辑文本 。

当我更改 XML 的顺序, 使 EditText 位于正确( 需要的) 位置时, 就会发生这种情况 。

发生在这条线上:

    EditText edtPassword = (EditText)findViewById(R.id.EditText03);

我感到困惑,因为他们没有任何联系。

<EditText
    android:id="@+id/EditText03"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:width="160dip" >

</EditText>
<TextView
    android:id="@+id/TextView03"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="UserName:" >

</TextView>
<TextView
    android:id="@+id/TextView04"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Password:">
</TextView>
// IF I MOVE AN EditText03 Here instead it just crashes.
最佳回答

i think it happened sometimes when same id for TextView and EditText in R.java file

所以您的代码重复了 R 文件, 但错误重现了, 正如我上面描述的 。

在您的工程中,您应该对每个视图使用独有的 ID 。

或者,如果您在 prj 中拥有所有视图的独特代号, 那么清理并运行您的工程 。

问题回答

暂无回答




相关问题
how to represent it in dtd?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ?

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

XStream serializing collections

I have a class structure that I would like to serialize with Xstream. The root class contains a collection of other objects (of varying types). I would like to only serialize part of the objects that ...

MS Word splits words in its XML format

I have a Word 2003 document saved as a XML in WordProcessingML format. It contains few placeholders which will be dynamically replaced by an appropriate content. But, the problem is that Word ...

Merging an XML file with a list of changes

I have two XML files that are generated by another application I have no control over. The first is a settings file, and the second is a list of changes that should be applied to the first. Main ...

How do I check if a node has no siblings?

I have a org.w3c.dom.Node object. I would like to see if it has any other siblings. Here s what I have tried: Node sibling = node.getNextSibling(); if(sibling == null) return true; else ...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

热门标签