2016-11-12 56 views
0

我試圖得到一個通知,有一個像下面這個通知保證金:如何創建通知保證金

enter image description here

你怎麼看通知的白不接觸的邊緣屏幕......這就是我的意思。

我嘗試這樣做:

BigTextStyle bigStyle = new NotificationCompat.BigTextStyle(); 
bigStyle.bigText(eventDescription); 

NotificationCompat.Builder notificationBuilder = 
     new NotificationCompat.Builder(this) 
     .setSmallIcon(R.drawable.ic_event) 
     .setLargeIcon(BitmapFactory.decodeResource(
       getResources(), R.drawable.notif_background)) 
     .setContentTitle(eventTitle) 
     .setContentText(eventLocation) 
     .setContentIntent(viewPendingIntent) 
     .addAction(R.drawable.ic_map, 
       getString(R.string.map), mapPendingIntent) 
     .setStyle(bigStyle); 

但產生的卡觸摸屏幕的邊緣。我怎樣才能做到這一點?

+0

參考http://stackoverflow.com/questions/18367631/change-notification-layout – sasikumar

回答

0

在Android Wear上,通知的位置和大小由系統控制。您發佈的屏幕截圖來自Android Wear的舊版本 - 新款式總是有卡片觸摸屏幕邊緣。

+0

感謝您的迴應,這是我所害怕的。你會碰巧提到這些信息嗎?我會深表感謝。 –

+0

我不認爲它是專門叫了,除了只左右服用文(https://developer.android.com/training/wearables/notifications/creating.html)中的[在訓練頁的頂帖]和通知中的圖標。 – ianhanniballake

0

您可以使用RemoteView來創建自定義視圖。

//充氣通知佈局RemoteViews

RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.notification); 
+0

我試過了,它不適合我。 –