无法为简单的TextView充气

时间:2016-05-12 09:34:43

标签: java android view textview

我的mainactivity文件没有一行代码,只有setContentView& onCreate方法。但我仍然在运行时遇到异常。 Drawable文件夹没有任何png或xml文件。

这是我的gradle依赖项:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
at android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
at android:paddingRight="@dimen/activity_horizontal_margin"
at android:paddingTop="@dimen/activity_vertical_margin"
at android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/final_result"
    android:text="Hello world"/>
</RelativeLayout>

这是XML:

05-12 07:32:48.8181838-1838/? E/VdcInflateDelegate﹕ Exception while inflating <vector>
org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportWidth > 0
at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:535)
at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:472)
at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:436)
at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:704)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:356)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:182)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:175)
at android.support.v7.widget.AppCompatDrawableManager.createDrawableIfNeeded(AppCompatDrawableManager.java:229)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:184)
.
.
.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.arslan.checkbox/com.example.arslan.checkbox.MainActivity}: android.view.InflateException: Binary XML file line #18: Error inflating class CheckBox
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
.
.
Caused by: android.view.InflateException: Binary XML file line #18: Error inflating class CheckBox
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:276)
.
.

这是LogCat

{{1}}

0 个答案:

没有答案