I read that we can add buttons to the Big view of notifications that is available from 4.1. I want the same layout with buttons in 4.0. I want to know if I use custom view for notification containing the buttons, Will that work in 4.0 ?
Thanks.
The notifications before 4.1 were limited which is why Big View notifications were introduced in 4.1
It isn't possible to have custom views before 4.1 unfortunately
One of the reasons for this is the height of the notification, its is limited so it doesn't fill up the screen.
Related
does anyone know how to define style like mediastyle for notifications in android. I want to use different background color for notification that appear on devices who has android version 5.0 or above. I want to use same color, but I want to use different height of notification, and I don't want a buttons in notification. Currently I use custom view for notification that has same background color like medaistyle notification, but custom view appears only on devices that has version of android lower then 5.0 . Can anyone help please
Thank you very much
I'm currently creating a custom status bar notification to notify the user of progress through an event. I have the custom notification working fine, but having a progress bar requires that I pass my own set of RemoteViews to the notification through the contentView field.
This is fine, except that I want to be able to base this layout off the default one. I am targeting API 10, and so it must work with both Gingerbread and ICS. Gingerbread is fine, as I can just put an icon on the left of the layout and the notification fits in with other default ones. In ICS however, the notification icons all have the striped square on the left that contains the icon (it effectively forms a UI "handle" to help indicate that the notification can be swiped to dismiss it).
Does anyone know how I can either get the default layout in code, and then edit it (this is hard with remoteViews), or somehow get access to default layout view (probably during runtime), then copy it, and substitute the notification text for my progress bar?
I have seen examples where people have created a notification and cloned the layout, but to do anything useful with that you have to know quite a lot about the layout. I would rather get the layout files from the android versions you are interested in. Here you have the JB one, you should not have any problems finding the others.
If the only reason you want a custom layout is to get a progress bar, you could look at
NotificationCompat.Builder.setProgress(). It'll be easier than playing with custom notification layouts. If you do decide to use custom layouts, they changed only slightly between API v14 and API v17, and I have no idea what they're like for Honeycomb but they're unlikely to be much different. What that means is that you should be able to use one custom notification layout in a layout-v11 folder, and one in your default layout folder, and you'll catch most cases (except for the icon background from Honeycomb upwards, I haven't gotten that part working in my own custom notifications yet) and only have to maintain two different layouts. See the answer above for the location of the default layout; note that it's called status_bar_latest_event_content.xml in earlier versions of Android.
Since setProgress() is available from Honeycomb upwards at least, and it looks like it works on earlier versions too (the docs don't say otherwise), then you should probably use that if you don't have any other custom requirements.
I'm trying to create a custom notification layout that looks just like a 3.0 notification, with a couple of extra things sprinkled in. More importantly, I also want to derive a Jelly Bean expanded notification on top of that.
I'd like the notification to have the same layout as a stock notification so it fits in nicely, i.e. like this (bottom image):
However, I cannot find any information about the proper dimensions and styles - what size do I need to use for the image on the left? What style for each text? What padding?
Ideally, I'd love to use something like android.R.listPreferredItemHeight for the height of the layout and the dimensions of the image, but I can't find anything that pertains to notifications.
You can use the Notification.Builder class which provides a convenient way to set the various fields of a Notification and generate content views using the platform's notification layout template.
See: http://developer.android.com/reference/android/app/Notification.Builder.html
If you need to be compatible with versions prior to API level 11 then take a look at the NotificationCompat.Builder from the support library.
i'm developing a SMS Widget.So came to across messages-widget
When i tried to replicate, the scroll feature is not available to that widget.
when i surfed, results where http://stackoverflow.com/questions/3879748/scrollable-textview-in-android-widget
Note i'm using Android 2.2 API Level 8.
Can anyone tell me how textview is scrollable with that opensource coding.
Is it possible to make a scrollable textview in widget ?
The link you provided is not a scrollable widget. It has buttons to move to the next/previous message.
HTC (and maybe others) have scrollable widgets, but it's their own implementation.
Scrollable widgets (with ListView and GridView) are available in Android 3.0+ (API 11+).
I want to change default android notification view. Can I make height of Custom Expanded View more than 3 lines of text?
Check this article on how to make custom notifications using your own layout. If this helps you already: good. If not: The RemoteView also offers options to create custom notifications, so it might help you. Alternatively you could create multiple notifications if the number of lines is really limited (which I am not sure of).