我有一个html页面,我正在webview中下载它,问题是它在Activity中正确加载,而在Fragments中它有滚动条(请参阅附图)
这是我的Fragment Java代码
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
v = inflater.inflate(R.layout.sem8subs, container, false);
wvsem8 = (WebView) v.findViewById(R.id.sem8web);
wvsem8.setWebChromeClient(new WebChromeClient());
wvsem8.clearCache(true);
wvsem8.clearHistory();
wvsem8.getSettings().setJavaScriptEnabled(true);
wvsem8.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
wvsem8.getSettings().setUseWideViewPort(true);
wvsem8.setWebViewClient(new MyWebViewClient());
getDataSem8S1();
downloadsem8s1 = (Button) v.findViewById(R.id.sem8btn);
// Capture button clicks
downloadsem8s1.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
progressDialog = ProgressDialog.show(getActivity(), "",
"Downloading Soft Computing...", true);
// Locate the class table named "ImageUpload" in Parse.com
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>(
"SemSubs8");
// Locate the objectId from the class
query.getInBackground("SasdsaHJac",
new GetCallback<ParseObject>() {
public void done(ParseObject object,
ParseException e) {
// TODO Auto-generated method stub
if (e == null) {
hold8sub1 = object.getString("subData");
saveDataSem8S1();
getDataSem8S1();
progressDialog.dismiss();
} else {
Toast.makeText(getActivity(), "Download Fail", Toast.LENGTH_SHORT).show();
progressDialog.dismiss();
}
}
});
}
});
return v;
}
这是xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/sem8btn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="download" />
<WebView
android:id="@+id/sem8web"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/sem8btn" />
</LinearLayout>
我无法弄清楚出了什么问题?
请帮忙