How to add buttons inside android notifications - android

I have managed to create this kind of notifications
following this guide: http://developer.android.com/training/notify-user/expanded.html#big-view
However I cannot find any documentation on how to achieve this style:
How can I do this?

As described in Custom notification layouts, you can set a custom content of the notification with Notification.Builder.setContent(RemoteViews)

You need to add custom notification layout and through the remote views.
http://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomNotification
https://stackoverflow.com/a/18414768/713778

Related

Android Notification with BigPicture style and BigText style

Does anyone can help me out here.How to implement BigPictureStyle notification with multiline summary text in android.I am able to do by reducing text size which I don't want to.Please help me out on this.
Can we combine two types of notification like big picture and big text style?Does any one know about this?
From your requirement i can figured out that you have to create custom layout for notification because basically you can not combine both BigPicture and BitText style so you have to go with the custom view for notification.
you can read this Custom notification for android as well example from this solution

how can i implement a filter view like this?

I thought that it's possibile within a fragment, but I'm young android developer and I will know which is the best way to implement it. Thanks a lot!
In Android you do it with an AlertDialog.
You'll want to implement one with a custom layout matching your picture.
An excerpt from the guide:
If you want a custom layout in a dialog, create a layout and add it to an AlertDialog by calling setView() on your AlertDialog.Builder object.
A quick search of Android material dialog with a custom view should give you a solution
Many libraries exist in gitub. Its just a mater of searching

Android Remoteviews for expanded notifications

The expanded notifications introduced in Jelly Bean allows adding actions. The actions appear as buttons in a row. If I wanted to modify this with my own custom view I would consider a remoteview.
Do expanded notifications allow for remoteviews? I can only find examples of remoteviews being used in simple notifications before the expanded notifications existed.
It appears that http://codeversed.com/expandable-notifications-android/ has the answer in the Custom View at the end.
So what if the rich notification styles don’t provide you with the
layout you need? Easy, just create your own layout and pass it to the
builder. One little fact to retain is that notifications use remote
views, which means you need to create a layout using a RemoteView.
Below is exactly how you would need to create this custom RemoteView.
notification.bigContentView = expandedView;

Where can I get a Notification item layout? Something like android.R.layout.?

As you can see in Android and OEM customisation, the items in Status Bar or Notification bar have different layouts.
The notification also differs depending on the Theme/Rom you installed.
Here is an example with Vanilla/Touchwizz/MIUI:
or or
What I would like to get is the layout, so I can include it in my activity and preview a notification inside my application.
I guess there is something similar to the android.R.layout.simple_list_item_1 for listview for instance.
Thank a lot for any help or any clue.
The layout for notification is located in separate SystemUI package: status_bar_latest_event (as of Android 2.3). This is not directly accessible from application. And if you could extract the layout, it wouldn't help you, as it uses custom com.android.systemui.statusbar.LatestItemView view. So you'd need to load that class into your process using PathClassLoader.
So theoretically this might be possible, but it's going to be tricky.

Size of custom view for android notification

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).

Categories

Resources