2016-11-12 58 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

我试过了,它不适合我。 –