1

出于某种原因,每次我尝试将图像添加到 SystemUi 时,它都会强制关闭我。以下是应该控制它的 xml:

tw_status_bar_expanded

LinearLayout android:orientation="vertical" android:id="@id/notificationCart" android:background="#ff000000" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="@dimen/status_bar_expanded_notification_category_height">
                <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
                    <ImageView android:layout_gravity="left|center" android:layout_width="wrap_content" android:padding="2.0dip" android:layout_height="@dimen/status_bar_expanded_notification_category_height" android:src="@drawable/notification_accent" android:scaleType="fitXY" />
                    <TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textStyle="bold" android:textColor="@color/notification_category_color" android:gravity="center" android:id="@id/latestNotificationText" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/status_bar_latest_events_title" android:layout_alignParentLeft="false" />
                    <ImageView android:layout_gravity="right|center" android:layout_width="wrap_content" android:padding="2.0dip" android:layout_height="@dimen/status_bar_expanded_notification_category_height" android:src="@drawable/notification_accent" android:scaleType="fitXY" />
               </LinearLayout>

公共.xml

<public type="drawable" name="notification_accent" id="0x7f020229" />

ids.xml

<item type="id" name="notification_accent">false</item>

使用 R$Drawable 中的 SMALI 声明:

.field public static final notification_accent:I = 0x7f020229

我知道,对不起,格式很糟糕。我可以诚实地归咎于三星。

E/AndroidRuntime( 5835): FATAL EXCEPTION: main

E/AndroidRuntime( 5835): java.lang.RuntimeException: Unable to create service com.android.systemui.SystemUIService: android.view.InflateException: Binary XML file line #32: Error inflating class <unknown>

E/AndroidRuntime( 5835):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2414)

E/AndroidRuntime( 5835):    at android.app.ActivityThread.access$1600(ActivityThread.java:140)

E/AndroidRuntime( 5835):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309)

E/AndroidRuntime( 5835):    at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime( 5835):    at android.os.Looper.loop(Looper.java:137)

E/AndroidRuntime( 5835):    at android.app.ActivityThread.main(ActivityThread.java:4898)

E/AndroidRuntime( 5835):    at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime( 5835):    at java.lang.reflect.Method.invoke(Method.java:511)

E/AndroidRuntime( 5835):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1008)

E/AndroidRuntime( 5835):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)

E/AndroidRuntime( 5835):    at dalvik.system.NativeStart.main(Native Method)

E/AndroidRuntime( 5835): Caused by: android.view.InflateException: Binary XML file line #32: Error inflating class <unknown>

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.createView(LayoutInflater.java:613)

E/AndroidRuntime( 5835):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)

E/AndroidRuntime( 5835):    at android.view.View.inflate(View.java:16434)

E/AndroidRuntime( 5835):    at com.android.systemui.statusbar.phone.PhoneStatusBar.makeStatusBarView(PhoneStatusBar.java:539)

E/AndroidRuntime( 5835):    at com.android.systemui.statusbar.phone.PhoneStatusBar.addStatusBarWindow(PhoneStatusBar.java:3098)

E/AndroidRuntime( 5835):    at com.android.systemui.statusbar.phone.PhoneStatusBar.createAndAddWindows(PhoneStatusBar.java:3067)

E/AndroidRuntime( 5835):    at com.android.systemui.statusbar.BaseStatusBar.start(BaseStatusBar.java:456)

E/AndroidRuntime( 5835):    at com.android.systemui.statusbar.phone.PhoneStatusBar.start(PhoneStatusBar.java:488)

E/AndroidRuntime( 5835):    at com.android.systemui.SystemUIService.onCreate(SystemUIService.java:94)

E/AndroidRuntime( 5835):    at android.app.ActivityThread.handleCreateService(ActivityThread.java:2404)

E/AndroidRuntime( 5835):    ... 10 more

E/AndroidRuntime( 5835): Caused by: java.lang.reflect.InvocationTargetException

E/AndroidRuntime( 5835):    at java.lang.reflect.Constructor.constructNative(Native Method)

E/AndroidRuntime( 5835):    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)

E/AndroidRuntime( 5835):    at android.view.LayoutInflater.createView(LayoutInflater.java:587)

E/AndroidRuntime( 5835):    ... 32 more

E/AndroidRuntime( 5835): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f020229 a=-1 r=0x7f020229}

E/AndroidRuntime( 5835):    at android.content.res.Resources.loadDrawable(Resources.java:1925)

E/AndroidRuntime( 5835):    at android.content.res.TypedArray.getDrawable(TypedArray.java:601)

E/AndroidRuntime( 5835):    at android.widget.ImageView.<init>(ImageView.java:120)

E/AndroidRuntime( 5835):    at android.widget.ImageView.<init>(ImageView.java:110)

E/AndroidRuntime( 5835):    ... 35 more

E/android.os.Debug( 2422): !@Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error

W/ActivityManager( 2422): Process com.android.systemui has crashed too many times: killing!

我觉得特别有趣的是……

 E/AndroidRuntime( 5835): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f020229 a=-1 r=0x7f020229}

虽然已经宣布了。我什至不知道它为什么会崩溃……

4

0 回答 0