【问题标题】:Getting Error in android's XML file在 android 的 XML 文件中出现错误
【发布时间】:2015-03-03 04:09:00
【问题描述】:

渲染期间引发的异常: 字符串索引超出范围:0 异常详细信息记录在窗口 > 显示视图 > 错误日志中 找不到以下类: - TextView(更改为 android.widget.TextView,修复构建路径,编辑 XML)

Getting this Error when i open graphic layout of XML file. Help me in resolving this. 

【问题讨论】:

  • 请发布您的 XML。
  • 你使用Button的背景为:android:background="@layout/button_style"什么是button_style?如果是样式,则将代码移至styles.xml,或者如果是选择器,则将其移至drawables。 tableleftborder 也是如此。然后在您的第一个 TextView 中添加 android:textStyle="normal"
  • 这是一个选择器。 N 移至可绘制对象。但仍然无法正常工作。还有其他建议吗?
  • 可爱的人.. 非常感谢.. 完成了 :) :) :)

标签: android


【解决方案1】:

您正在使用 Button 的背景为:android:background="@layout/button_style"

button_style 是什么?如果是样式,请将代码移至styles.xml ,如果是selector,则将其移至drawables。 TextView 中的tableleftborder 也是如此。

其次,在您的第一个 TextView 中添加 android:textStyle="normal" 或简单地将其删除以使其类似于以下内容:

       <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:text="UGD Demand Details"
        android:textColor="#FFF"
        android:textSize="20sp"/>

希望对你有帮助:)

【讨论】:

  • 帮助好友.. :) 谢谢你.. :)
【解决方案2】:

Header RelativeLayout 中的第一个 textView 有一个 android:textStyle="",scrollView 内的 RelativeLayout 也有 android:height="match_parent" 这应该是“wrap_content”

【讨论】:

  • 多米尼克改了。还是一样的例外。
  • android:textStyle="" 我从您的代码以及所有 android:background="@layout/button_style" 和 tableleftborder 中删除了此属性,错误消失了
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-12-26
  • 1970-01-01
  • 1970-01-01
  • 2013-12-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多