0

I have a simple paragraph that has bullets.

How can i indent my whole bulletlist from:

some text here..
• item 1
• item 2
• item 3

to

some text here..
     • item 1 text here text here text here
        ext here text here text here

     • item 2
        ext here text here text here

     • item 3
        ext here text here text here

BTW, im using these codes:

for (int i = 0; i < bulletListArray.length; i++) {
            String text = bulletListArray[i];
            SpannableString s = new SpannableString(text + "\n");
            // s.setSpan(new BulletSpan(), 1, text.length(),
            // Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            s.setSpan(new BulletSpan(10), 0, text.length(), 0);
            allText = TextUtils.concat(allText, s);

I appreaciate your help!

thanks.

ohhzumm
  • 98
  • 1
  • 12

3 Answers3

0
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    android:id="@+id/ScrollViewTipsLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
        android:id="@+id/TipsLayout"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content">

        <TableLayout
        android:layout_height="wrap_content"
        android:id="@+id/TableLayout01"
        android:layout_width="wrap_content"
    >
        <TableRow>
            <TextView android:id="@+id/tvIngress"
                android:layout_height="wrap_content" 
                android:layout_width="wrap_content" 
                android:text="@+string/tv_picking_content_ingress"
                android:layout_span="2"
                android:singleLine="false"
                android:layout_weight="1"
            />
        </TableRow>
        <TableRow>
            <TextView android:id="@+id/tvCleaningDot1"
                android:layout_height="wrap_content" 
                android:text="•"
                android:singleLine="false"
            />
            <TextView android:id="@+id/tvCleaningFirst"
                android:layout_height="wrap_content" 
                android:text="@+string/tv_picking_content_first" 
                android:layout_width="0dp"
                android:layout_weight="1"
                android:gravity="left"
                android:singleLine="false" 
            />
        </TableRow>
            <TextView android:id="@+id/tvCleaningDot2"
                android:layout_height="wrap_content" 
                android:text="•"
                android:singleLine="false"
            />
            <TextView android:id="@+id/tvCleaningSecond"
                android:layout_height="wrap_content" 
                android:text="@+string/tv_picking_content_second" 
                android:layout_width="0dp"
                android:layout_weight="1"
                android:gravity="left"
                android:singleLine="false"
            />
        </TableRow>
    </TableLayout>
</RelativeLayout>

You should see here

Community
  • 1
  • 1
Augustus Francis
  • 2,694
  • 4
  • 22
  • 32
0

Edited my answer: Sorry I didn't realize that <ul> and <li> are not supported by the strings.xml.

Can't you just and blank spaces at before your String?

In here

Instead of: SpannableString s = new SpannableString(text + "\n");

Try using : SpannableString s = new SpannableString(text + "\n ");

Or if you want it to be exactly the indentantion of the TAB you can do: SpannableString s = new SpannableString(text + "\n\t");

Edit: Just tested building a string with:

<string name="dummy_string">
    <p> Here is some text! </p> \n\t
        &#8226; item one \n \t
         &#8226; item two \n \t
        &#8226; item three\n \t
</string>

And worked perfectly. A bullet list with indentations :P

Marcus Gabilheri
  • 1,259
  • 1
  • 14
  • 26
  • @DerGolem you can use: • to get a bullet in Strings.xml but the problem for her is the margin. And that doesn't solves the margin problem :( – Marcus Gabilheri Jun 07 '14 at 18:41
  • Well but what if in the same textview there is text that should be indented and others that shouldn't. I guess that is her problem. I edited my answer because I didn't saw that stack overflow rendered my `
      and
    • ` tag to look like a bullet point. I guess that is what mislead your comment to my answer to think that bullet point is not supported.
    – Marcus Gabilheri Jun 07 '14 at 18:48
  • @MarcusGabilheri Ahahahahah! Yes, that was the tricky part... ;) – Phantômaxx Jun 07 '14 at 19:05
  • That's what i did first. but what i wanted is the whole text be indented even if it steps in the new line. – ohhzumm Jun 09 '14 at 01:27
0
for (int i = 0; i < bulletListArray.length; i++) {
    TextView tv = (TextView)findViewById(idList[i]); //ex: R.id.tv1,R.id.tv2....
    CharSequence cs = bulletListArray[i];
    SpannableString ss = new SpannableString(cs);
    ss.setSpan(new BulletSpan(15), 0, cs.length(), 0);
    mTv.setText(ss);
}
Augustus Francis
  • 2,694
  • 4
  • 22
  • 32
  • You should add this as an adding to your previous answer. Or do you want to "harvest" reputation points? – Phantômaxx Jun 07 '14 at 18:34
  • Both of them are two separate methods. That is why I added them as seperate. One uses XML and other Java. Should I be posting them on one Answer thread. I thought it might be confusing. If that's the case I will keep that in mind the next time.. @DerGolem – Augustus Francis Jun 08 '14 at 06:25