2016-10-17 55 views
0

我的佈局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); 

我的問題是什麼?非常感謝現在...

回答

0

在你的build.gradle依賴性增加:

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

或者代碼:

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

PLZ檢查你的build.gradle文件中添加

+0

我在之前添加了編譯行。但是不起作用 –

相關問題