在我的应用中,我有一个SplashScreen活动。当我点击应用程序时,我有setStateLocked错误。我正在使用运行Android 5.1的Fortune Ship MTN-S730。
这是onCreate方法
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_screen); /* logcat says error on this line */
}
据说,错误与
一致的setContentView(R.layout.activity_splash_screen);
这是logcat的输出
setStateLocked: wasEnabled = false, mIsEnabled = false, wasTouchExplorationEnabled = false,
mIsTouchExplorationEnabled = false, wasHighTextContrastEnabled = false, mIsHighTextContrastEnabled = false
java.lang.Throwable: setStateLocked
at android.view.accessibility.AccessibilityManager.setStateLocked(AccessibilityManager.java:553)
at android.view.accessibility.AccessibilityManager.tryConnectToServiceLocked(AccessibilityManager.java:636)
at android.view.accessibility.AccessibilityManager.<init>(AccessibilityManager.java:226)
at android.view.accessibility.AccessibilityManager.getInstance(AccessibilityManager.java:206)
at android.view.View.setFlags(View.java:9843)
at android.view.ViewGroup.initViewGroup(ViewGroup.java:536)
at android.view.ViewGroup.<init>(ViewGroup.java:525)
at android.view.ViewGroup.<init>(ViewGroup.java:520)
at android.view.ViewGroup.<init>(ViewGroup.java:516)
at android.view.ViewGroup.<init>(ViewGroup.java:512)
at android.widget.FrameLayout.<init>(FrameLayout.java:119)
at com.android.internal.policy.impl.PhoneWindow$DecorView.<init>(PhoneWindow.java:2326)
at com.android.internal.policy.impl.PhoneWindow.generateDecor(PhoneWindow.java:3460)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3846)
at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:2042)
at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:371)
at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:320)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:281)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143)
at com.cm_floraison.brandbook.gesu.SplashScreenActivity.onCreate(SplashScreenActivity.java:101)
at android.app.Activity.performCreate(Activity.java:6092)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1112)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2468)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2595)
at android.app.ActivityThread.access$800(ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5631)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
以下是活动的清单声明
<activity
android:name=".gesu.SplashScreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
还有activity_splash_screen.xml的内容
<FrameLayout 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"
android:background="@color/colorPrimary"
tools:context="com.cm_toure.myapp.gesu.SplashScreenActivity">
<!-- The primary full-screen view. This can be replaced with whatever view
is needed to present your content, e.g. VideoView, SurfaceView,
TextureView, etc. -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/fullscreen_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:contentDescription="@string/app_logo"
android:foregroundGravity="center"
android:keepScreenOn="true"
android:src="@drawable/ic_logo_brandbook_paysage_sur_fond_blanc"
/>
</LinearLayout>
<!-- This FrameLayout insets its children based on system windows using
android:fitsSystemWindows. -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<LinearLayout
android:id="@+id/fullscreen_content_controls"
style="?metaButtonBarStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:orientation="vertical"
tools:ignore="UselessParent">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="10dp"
android:indeterminate="true"
android:indeterminateDrawable="@drawable/splash_spinner_style"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="50dp"
android:layout_weight="1"
android:background="@color/colorPrimary"
android:text="@string/powered_by"
android:textAlignment="center"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="18sp"/>
</LinearLayout>
</FrameLayout>
</FrameLayout>