how to align text in android when using html code -


i create imageview , textview in android of html code question how align text , when click read more open new pase so.. here full source code.can me please.thanks in advance

mainactivity

public class mainactivity extends activity {  private final string htmltext = "<body><h1>heading text</h1><p>we understand different client have different needs , requirements therefore special effort might required fulfill these requirements. our custom software development services aimed fulfill......read more &nbsp;</p>" +              "<blockquote>example <a href=\"www.javatechig.com\">" +             "javatechig.com<a></blockquote></body>";  @override protected void oncreate(bundle savedinstancestate) {            super.oncreate(savedinstancestate);            setcontentview(r.layout.activity_main);            textview htmltextview = (textview)findviewbyid(r.id.html_text);           htmltextview.settext(html.fromhtml(htmltext));  } } 

my layout

    <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"         xmlns:tools="http://schemas.android.com/tools"         android:layout_width="match_parent"         android:layout_height="match_parent"          tools:context=".mainactivity"          >          <imageview             android:id="@+id/imageview1"             android:layout_width="35dp"             android:layout_height="35dp"             android:layout_alignparentleft="true"             android:layout_alignparenttop="true"             android:src="@drawable/home" />          <textview             android:id="@+id/html_text"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_alignparenttop="true"             android:layout_marginleft="5dp"             android:layout_torightof="@+id/imageview1"              />      </relativelayout> 

to align text below image remove following lines text view in layout

android:layout_alignparenttop="true" android:layout_torightof="@+id/imageview1" 

and add following line

android:layout_below="@+id/imageview1" 

with webview

replace layout following code

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context=".mainactivity" >      <imageview         android:id="@+id/imageview1"         android:layout_width="35dp"         android:layout_height="35dp"         android:layout_alignparentleft="true"         android:layout_alignparenttop="true"         android:src="@drawable/ic_launcher" />      <webview          android:id="@+id/webview"         android:layout_below="@id/imageview1"         android:layout_width="match_parent"         android:layout_height="wrap_content"/> </relativelayout> 

and use following code in activity

private final string htmltext = "<body><h1>heading text</h1><p>we understand different client have different needs , requirements therefore special effort might required fulfill these requirements. our custom software development services aimed fulfill......read more &nbsp;</p>" +              "<blockquote>example <a href=\"http://www.javatechig.com\">" +             "javatechig.com<a></blockquote></body>";      private webview m_webview;     @override     protected void oncreate(bundle savedinstancestate)     {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);          m_webview = (webview) findviewbyid(r.id.webview);          m_webview.setwebviewclient(new webviewclient() {              @override             public boolean shouldoverrideurlloading(webview view, string url)             {                  if(url.equalsignorecase("http://www.javatechig.com/")) {                      toast.maketext(mainactivity.this, url, toast.length_short).show();                      return true;                  }                 return super.shouldoverrideurlloading(view, url);             }          });          m_webview.loaddatawithbaseurl("", htmltext, "text/html", http.utf_8, null);     } 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -