与Android未知充气错误 [英] Unknown inflate error with android

查看:136
本文介绍了与Android未知充气错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的Andr​​oid应用程序有问题。问题是,当我尝试建立新的看法。

Hi i'm having a problem with my android app. The problem is when i try to set up new view.

    public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
        if (v == null) {
            try{
            LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.list, null);
            }
            catch(Exception e){
                String a=e.toString();
            }
        } 

在行V = vi.inflate(R.layout.list,NULL);我得到这个错误:

in line v = vi.inflate(R.layout.list, null); i get this error:

    android.view.InflateException: Binary XML file line #5: Error inflating class <unknown> 

下面也是我list.xml文件:

Here is also my list.xml file:

    <?xml version="1.0" encoding="utf-8"?>
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
    <TableRow
        android:layout_width="fill_parent"
        android:layout_height="15dp"
        android:background="@drawable/bg_seznam" >
        <TextView
            android:id="@+id/item_title"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="17dp"
            android:textColor="#ffffff"
            android:textSize="20dp"
            android:textStyle="bold"
            android:typeface="serif" >
        </TextView>         
    </TableRow>
    </TableLayout>

因此​​,任何想法?

So any ideas?

推荐答案

我想你的code和它工作正常,在我的身边。结果
或许,做一个干净的,将有助于:项目 - >清洁 - >选择您的项目 - >确定

I tried your code and it works fine on my side.
Perhaps doing a clean would help: Project -> Clean -> Select your project -> OK.

这篇关于与Android未知充气错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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