0

I want to display the this url to my webview https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2FJilJilRadio&width=50&layout=button&action=like&show_faces=false&share=false&height=35&appId=251942224997078

I want to load this url to center horizontally.But it displays at the left most corner of the layout

main.xml

 <RelativeLayout
            android:layout_width="100dp"
            android:layout_height="60dp"
            android:layout_centerInParent="true"
            android:background="#ffff00" android:gravity="center" 
         >
   <WebView
                android:id="@+id/webview2"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_below="@+id/tv1"                   
                android:layout_centerInParent="true"
               android:layout_centerHorizontal="true" />
  </RelativeLayout>

Activity.java

WebView myBrowser = (WebView) findViewById(R.id.webview2);
        myBrowser.getSettings().setJavaScriptEnabled(true);
        myBrowser.setBackgroundColor(0x00000000);
myBrowser.loadUrl(fbURL);

This is the screen enter image description here

Kalai
  • 469
  • 2
  • 9
  • 20
  • android:orientation="vertical" i dont think that RelativeLayout has a orientation attribute – Niraj Adhikari Aug 15 '14 at 11:54
  • @NirajAdhikari Ok.But this is not the solution – Kalai Aug 15 '14 at 12:01
  • 1
    Indeed @NirajAdhikari, there isn't this attribute in RelativeLayout, but this doesn't affect the layout. Kalai, did you see this question [Setting webview at the center of relative layout](http://stackoverflow.com/questions/9938464/setting-webview-at-the-center-of-relative-layout)? – Blo Aug 15 '14 at 12:07
  • @Fllo yes i saw that question.But it didnt work for me – Kalai Aug 15 '14 at 12:24

0 Answers0