我想让通知图像适合通知的高度,如下所示:
但我看到的是这样的:
我的代码是:
Client client = new Client(Configuration.getServer());
String str = client.getBaseURI("offers");
try {
JSONArray json = new JSONArray(str);
for (int i = 0; i < json.length(); i++) {
JSONObject oneOffer = json.getJSONObject(i);
int offerID = oneOffer.getInt("ID");
String offerDescriptoin = oneOffer.getString("Description");
String endDate = oneOffer.getString("EndDate");
String startDate = oneOffer.getString("StartDate");
JSONObject restaurant = oneOffer.getJSONObject("Restaurant");
int restaruantID = restaurant.getInt("ID");
String restaurantName = restaurant.getString("Name");
Offer offer = new Offer(offerID, startDate, endDate,
offerDescriptoin, new Restaurant(restaruantID,
restaurantName));
Log.d("DES", offerDescriptoin);
Offer.getAllOffers().put(offer.getID(), offer);
Intent intent = new Intent(this, OfferNotification.class);
PendingIntent pIntent = PendingIntent.getActivity(this, 0,
intent, 0);
Uri soundUri = RingtoneManager
.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
this).setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Offer from " + restaurantName)
.setContentText(offerDescriptoin).setSound(soundUri);
// Creates an explicit intent for an Activity in your app
Intent resultIntent = new Intent(this, OfferNotification.class);
resultIntent.putExtra("offerID", offer.getID());
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(OfferNotification.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder
.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(offer.getID(), mBuilder.build());
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
我的意思是第二种情况下的光子(第二张照片)很小,文字在它下面,但我想像第一种情况一样,照片全高,文字留给照片