12

わかりました、多くの人がこの質問を次のように却下するのを見ました

「OS コンポーネント用に予約されています」

「ソースへのアクセスが必要です」

ソースにアクセスできるので、必要なアプリやウィジェットをシステム アプリとして設定できます。では、ウィジェットの右側に通知を表示するにはどうすればよいでしょうか。

編集: OK ppl は間違った方向に進んでいるので、ここにコンテキストを追加してください。. . あなたの電話を見てください。. . 電話の右側に常に Wi-Fi 信号と電話信号が表示されます。私の信号もそこに表示されます。. . システム信号とともに。. 私の会社が作っているタブレットに新しいハードウェア チップがあり、電話の信号と同じように信号強度を常に表示する必要があります。タブレットの Android ソースに統合される予定です。

4

5 に答える 5

7

https://android.googlesource.com/platform/frameworks/base/+/android-4.3_r3.1/packages/SystemUI/src/comで、電話ステータス バーの Android ソース コードのコードを参照する必要がある場合があります。 /android/systemui/statusbar/phone/PhoneStatusBar.java

そして、次のような方法を見てください

addIcon
updateIcon
removeIcon

自分でたくさんのものを追加する必要があるため、簡単な作業ではありません。

于 2013-12-10T09:39:09.753 に答える
2

いくつかの場所を変更する必要があります。

Framework/base/core/res/res/values/config.xml にスロットを追加します。 <string-array name="config_statusBarIcons">

次に、frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java:

mService.setIcon("<your slot name>", R.drawable.yourlogo, 0, null);
mService.setIconVisibility("<your slot name>", setVisible);

残りは試行錯誤しながら自分で解決できると思います。

于 2014-09-23T16:19:44.843 に答える
0

簡単なアイデアが 1 つあります。

マニフェストで、Android の画面の向きを横向きとして宣言し、縦向きモードでは横向きのようにデザインして、アプリが横向きモードで縦向きに見えるようにします。

于 2013-08-21T06:34:05.577 に答える
-1
public class GCMIntentService extends GCMBaseIntentService {

public static final String PROJECT_ID = "4898989797";
private static final String TAG = "GCMIntentService";
ModelNotificationMessage modelNotificationMessage;

public GCMIntentService() {
    super(PROJECT_ID);
    Log.d(TAG, "GCMIntentService init");
}

@Override
protected void onError(Context ctx, String sError) {
    // TODO Auto-generated method stub
    Log.d(TAG, "Error: " + sError);

}

@Override
protected void onMessage(Context ctx, Intent intent) {

    Log.d(TAG, "Message Received");

    String message = intent.getStringExtra("message");

    Log.d(TAG, "Message Received" + message);

    sendNotification(message);
    Intent broadcastIntent = new Intent();
    broadcastIntent.setAction("GCM_RECEIVED_ACTION");

    broadcastIntent.putExtra("gcm", message);

    ctx.sendBroadcast(broadcastIntent);
}




 private void sendNotification(String message) {
            // this
            String ns = Context.NOTIFICATION_SERVICE;
            NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);

            int icon = R.drawable.notification;
            CharSequence tickerText = message; // ticker-text
            long when = System.currentTimeMillis();
            Context context = getApplicationContext();
            CharSequence contentTitle = modelNotificationMessage.getKey();
            CharSequence contentText = message;
            Intent notificationIntent = null;
            int NOTIFICATION_ID = 9999;



                NOTIFICATION_ID = CommonVariable.notification_message;
                notificationIntent = new Intent(this, ViewMessages.class);
                contentText = arrayList.get(0).getDescription();
                tickerText = arrayList.get(0).getDescription();

            // and this
            PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
                    notificationIntent, 0);
            Notification notification = new Notification(icon, tickerText, when);
            // Play default notification sound
            notification.defaults |= Notification.DEFAULT_SOUND;
            notification.setLatestEventInfo(context, contentTitle, contentText,
                    contentIntent);
            mNotificationManager.notify(NOTIFICATION_ID, notification);
        }
于 2013-08-21T06:16:50.440 に答える
-1

このフォーラムであなたの質問に関連する情報を見つけました...

http://forum.kde.org/viewtopic.php?t=107601

- 良い一日

于 2013-08-21T06:17:24.387 に答える