I need to place the date as título de un Listview
but inside a bubble
, could someone tell me how to do it.
Here is the code to put thefecha como título:
readFechaActual();
TextView textView = new TextView(context);
textView.setText(stringDate);
listView.addHeaderView(textView);
But what I need is a title like this:
Here the file to create the bubble:
drawable/time_message.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/SALMON" />
<corners android:radius="20dp" />
You can use setBackgroundResource to programmatically set the style, it would look like this:
With regard to your style
shape
you can add apadding
:You can play with
padding
him at your convenience.You can make several options, first create your background
define it as background to your
TextView
in the layout :You can also define the background programmatically:
you would get something similar to: