【发布时间】:2023-01-03 00:12:23
【问题描述】:
我用 api 获取页面的内容。 但它不显示所有内容。
Log.e("content",newsDetailModel.getFullContent()); //it shows all data
WebSettings settings = news_details_content.getSettings();
settings.setJavaScriptEnabled(true);
settings.setAllowContentAccess(true);
settings.setDomStorageEnabled(true);
news_details_content.setWebChromeClient(new WebChromeClient());
String content = newsDetailModel.getFullContent();
news_details_content.loadData(content, "text/html", "utf8");
我的看法:
<?xml version="1.0" encoding="utf-8"?>
<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"
android:orientation="vertical"
android:background="@color/background">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp">
<ImageView
android:id="@+id/news_details_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"/>
<WebView
android:id="@+id/news_details_content"
android:layout_width="match_parent"
android:layout_gravity="right"
android:layout_height="wrap_content"/>
</LinearLayout>
</RelativeLayout>
【问题讨论】:
-
ca 请在此处添加您的完整布局文件?
-
@达瓦拉。添加了完整的布局。