无法启动活动资源$ NotFoundException:.xml来自xml布局资源ID#0x7f040031

时间:2016-10-17 10:28:51

标签: android layout

我的布局xml文件有问题。我的错误是;

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo android.content.res.Resources$NotFoundException: File res/layout/activity_splash.xml from xml type layout resource ID #0x7f040031
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2313)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
   at android.app.ActivityThread.access$600(ActivityThread.java:156)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:153)
   at android.app.ActivityThread.main(ActivityThread.java:5336)
   at java.lang.reflect.Method.invokeNative(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
   at dalvik.system.NativeStart.main(NativeStart.java)

和我的xml布局是;

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:wheel="http://schemas.android.com/apk/res-auto"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".SplashActivity">

<com.pnikosis.materialishprogress.ProgressWheel
    android:id="@+id/progress_wheel"
    android:layout_width="80dp"
    android:layout_height="80dp"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    wheel:matProg_barColor="#E5E4E2"
    wheel:matProg_progressIndeterminate="true" />
</RelativeLayout>

这是我的错误行;

setContentView(R.layout.activity_splash);

我的问题是什么?非常感谢...

1 个答案:

答案 0 :(得分:0)

添加build.gradle依赖项:

compile 'com.pnikosis:materialish-progress:1.7'

或代码:

ProgressWheel wheel = new ProgressWheel(context);
wheel.setBarColor(Color.BLUE);

请检查您是否在build.gradle文件中添加