I am building an app that has a WebView configured in an xml (fragment_recent_news) driven by the file (Recent News), While the webview is configured to meet the main bar in the xml (see picture), the webview actually goes further up under the main bar than it should, as though it is not following the relative layout guidelines. What am I doing wrong?
fragment_recent_news(xml):
<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="com.hardingsoftware.hrcfitness.RecentNews"> <WebView android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/webview" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" /> </RelativeLayout> RecentNews:
package com.hardingsoftware.hrcfitness; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; /** * A simple {@link Fragment} subclass. */ public class RecentNews extends Fragment { WebView webView; //final static String myBlogAddr = "http://www.hrcfitness.com/recent-news/"; //String myUrl; public RecentNews() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View rootView = inflater.inflate(R.layout.fragment_recent_news, container, false); WebView myWebView = (WebView) rootView.findViewById(R.id.webview); myWebView.loadUrl("http://hrcfitness.com"); WebSettings webSettings = myWebView.getSettings(); webSettings.setJavaScriptEnabled(true); return rootView; } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } }
No comments:
Post a Comment