Android having paragraph and numbering/bullets on textview -


i creating app, have description have steps. example:

how transfer:

  • -do have credit card

  • -if dont make fake one

  • -then insert atm

  • -and watch explode

how catch fish:

  • open console
  • use cheat
  • you got one

and getting longer...

these description(steps) displayed in scrollview, right make using java, settext use "\n" , " " empty space trick diplay. wont work different resolutions. how make textview display this?

based on answer,i tried this: .xml on layout

 <scrollview         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_marginbottom="16dp"         android:layout_margintop="16dp" >             <textview                 android:id="@+id/tvcbajud"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                           android:text="@string/transfer"                 android:textsize="16sp"                 />     </scrollview> 

and define string:

 <string name="transfer">how transfer \n         <ul>         <li>-do have credit card</li>          <li>-if dont make fake one</li>          <li>-then insert atm</li>           <li>-and watch explode</li>          </ul></string> 

but output become:

how transfer -do have credit card -if dont make fake 1 -then insert atm -and watch explode 

if text static can extend textview automatically prepend bulletspan before android:text:

layout.xml

<bullettextview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="orange" /> <bullettextview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="banana" /> 

bullettextview.java

/**  * {@link textview} automatically adds bullet point text if set in layout  */ public class bullettextview extends textview {     public bullettextview(context context) {         super(context);         addbullet();     }      public bullettextview(context context, attributeset attrs) {         super(context, attrs);         addbullet();     }      public bullettextview(context context, attributeset attrs, int defstyleattr) {         super(context, attrs, defstyleattr);         addbullet();     }      public bullettextview(context context, attributeset attrs, int defstyleattr, int defstyleres) {         super(context, attrs, defstyleattr, defstyleres);         addbullet();     }      private void addbullet() {         charsequence text = gettext();         if (textutils.isempty(text)) {             return;         }         spannablestring spannable = new spannablestring(text);         spannable.setspan(new bulletspan(16), 0, text.length(), 0);         settext(spannable);     } } 

you can further customize adding custom attribute indentation.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -