2012-11-23 6 views

risposta

21

http://code.google.com/p/android-flowtextview/

enter image description here

Esempio di utilizzo:

<com.pagesuite.flowtext.FlowTextView 
      android:id="@+id/tv" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" > 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentTop="true" 
       android:padding="10dip" 
       android:src="@drawable/android" /> 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentRight="true" 
       android:layout_marginTop="400dip" 
       android:padding="10dip" 
       android:src="@drawable/android2" /> 
     </com.pagesuite.flowtext.FlowTextView> 

il tuo codice:

per Testo:

tv = (FlowTextView) findViewById(R.id.tv);     
tv.setText("my string"); // using plain text  
tv.invalidate(); // call this to render the text 

per HTML:

tv = (FlowTextView) findViewById(R.id.tv);    
Spanned spannable = Html.fromHtml("<html ... </html>"); 
tv.setText(spannable); // using html 
tv.invalidate(); // call this to render the text 
+0

sto ottenendo il testo da webservice come posso impostare il testo in html – Victor

+0

Non dovete convertirlo in HTML. non usare spanable solo tv.setText (yourtextfromwebservice); – Talha

+0

come posso convertire il testo del servizio web in html @talhakosen – Victor

Problemi correlati