I have a TextView and I want to add a bullet symbol in my text through XML. Is it possible?
11 Answers
You have to use the right character encoding to accomplish this effect. You could try with •
Update
Just to clarify: use `setText("\u2022 Bullet");` to add the bullet programmatically. `0x2022 = 8226`
- 21,988
- 13
- 81
- 109

- 10,431
- 11
- 53
- 83
-
1[This](http://en.wikipedia.org/wiki/Character_encodings_in_HTML#XML_character_references) helped me. – Vikas Jan 17 '11 at 05:15
-
4This is the right answer. More correct than pasting the bullet in. – Kyle Clegg Mar 23 '12 at 21:51
-
2@Benny, This is not working if I set text programmatically. textView.setText("• hello"); – Ashish Dwivedi Apr 23 '14 at 05:27
-
@DwivediJi No, but the question was how to add it in XML. If you have a new question - feel free to ask :-) – Benny Skogberg Apr 23 '14 at 05:48
-
30Just to clarify: use `setText("\u2022 Bullet");` to add the bullet programmatically. `0x2022 = 8226` – Diederik Aug 21 '14 at 06:48
-
· by using this I got a smaller size bullet – Akhil Dad Feb 05 '16 at 09:55
-
172Here are character code to these different style of bullets: `• = \u2022, ● = \u25CF, ○ = \u25CB, ▪ = \u25AA, ■ = \u25A0, □ = \u25A1, ► = \u25BA` – quent Jul 10 '16 at 00:01
-
For Android: **In XML>>>** `•` and **In Java>>>** `\u2022` – sud007 Dec 23 '16 at 11:13
-
• vs • in XML, which one to use and why? – Ken Ratanachai S. Mar 16 '17 at 04:46
This worked for me:
<string name="text_with_bullet">Text with a \u2022</string>

- 12,655
- 9
- 63
- 99

- 901
- 6
- 5
Copy paste: •. I've done it with other weird characters, such as ◄ and ►.
Edit: here's an example. The two Button
s at the bottom have android:text="◄"
and "►"
.

- 88,392
- 43
- 149
- 167
-
8
-
4just use a linear layout with orientation horizontal, first textview with "Icon and Space" second :=) the text, => all intended – cV2 Aug 15 '11 at 16:10
Prolly a better solution out there somewhere, but this is what I did.
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TableRow>
<TextView
android:layout_column="1"
android:text="•"></TextView>
<TextView
android:layout_column="2"
android:layout_width="wrap_content"
android:text="First line"></TextView>
</TableRow>
<TableRow>
<TextView
android:layout_column="1"
android:text="•"></TextView>
<TextView
android:layout_column="2"
android:layout_width="wrap_content"
android:text="Second line"></TextView>
</TableRow>
</TableLayout>
It works like you want, but a workaround really.

- 273
- 2
- 6
You may try BulletSpan as described in Android docs.
SpannableString string = new SpannableString("Text with\nBullet point");
string.setSpan(new BulletSpan(40, color, 20), 10, 22, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

- 4,110
- 1
- 37
- 55
-
4
-
-
@UsmanRana yes you can try replacing 20 i.e. the third argument in the BulletSpan constructor with your preferred size, which represent radius. BulletSpan(int gapWidth, int color, int bulletRadius) – Faisal Naseer Dec 16 '21 at 05:23
Another best way to add bullet in any text view is stated below two steps:
First, create a drawable
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<!--set color of the bullet-->
<solid
android:color="#666666"/> //set color of bullet
<!--set size of the bullet-->
<size
android:width="120dp"
android:height="120dp"/>
</shape>
Then add this drawable in textview and set its pedding by using below properties
android:drawableStart="@drawable/bullet"
android:drawablePadding="10dp"

- 171
- 1
- 14
This is how i ended up doing it.
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<View
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@drawable/circle"
android:drawableStart="@drawable/ic_bullet_point" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Your text"
android:textColor="#000000"
android:textSize="14sp" />
</LinearLayout>
and the code for drawbale/circle.xml is
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="0dp"
android:shape="ring"
android:thickness="5dp"
android:useLevel="false">
<solid android:color="@color/black1" />
</shape>

- 956
- 9
- 16
With Unicode we can do it easily, but if want to change color of bullet, I tried with colored bullet image and set it as drawableStart
and it worked
<TextView
android:text="Hello bullet"
android:drawableStart="@drawable/bulleticon" >
</TextView>

- 18,333
- 31
- 67
- 74

- 13,409
- 16
- 61
- 96
Since android doesnt support <ol>, <ul> or <li>
html elements, I had to do it like this
<string name="names"><![CDATA[<p><h2>List of Names:</h2></p><p>•name1<br />•name2<br /></p>]]></string>
if you want to maintain custom space then use </pre> tag

- 7,361
- 3
- 43
- 52
(almost) all of the options are about using html
tags.
you can use drawables for your TextView if it has only one line of text.
something like this:
<TextView
android:id="@+id/tv_with_bullet"
android:layout_width="match_parent"
android:layout_height="50dp"
app:drawableStartCompat="@drawable/ic_desired_bullet_icon" />
and add your desired bullet drawable in SVG. it literally takes no space and makes you free of adding complicated string literals
. you can also download the SVG file for a bullet point in here

- 89
- 2
- 11
I create this extensión function in Kotlin
fun TextView.addBulletPoints(bulletSymbol: Char = '•') {
//•‣⁃∙◎◦⦾⦿
val lines = text?.split("\n") ?: emptyList()
val builder = SpannableStringBuilder()
for (line in lines) {
builder.append("$bulletSymbol ")
builder.append(line.trim())
builder.append("\n")
}
text = builder
}
or alternative API 24 upper
fun TextView.addBulletPoints(bulletGapWidth: Int = 32, bulletRadius: Int = 12, color: Int = currentTextColor) {
val lines = text?.split("\n") ?: emptyList()
val builder = SpannableStringBuilder()
for (line in lines) {
val start = builder.length
builder.append(line.trim())
builder.setSpan(BulletSpan(bulletGapWidth, color, bulletRadius), start, builder.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
builder.append("\n")
}
text = builder
}

- 2,604
- 1
- 25
- 25