Android 当按下链接时,RSS阅读器具有webview的空白屏幕
我正在为www.platform-online.net创建一个RSS阅读器,我完全无法理解为什么按下RSS链接时网页不会显示 我确信它在某种程度上涉及到webview,所以我给你两个涉及它的类:Android 当按下链接时,RSS阅读器具有webview的空白屏幕,android,xml,eclipse,webview,rss,Android,Xml,Eclipse,Webview,Rss,我正在为www.platform-online.net创建一个RSS阅读器,我完全无法理解为什么按下RSS链接时网页不会显示 我确信它在某种程度上涉及到webview,所以我给你两个涉及它的类: > package com.daryl.rssreader; import android.app.Activity; import android.os.Bundle; import android.webkit.WebSettings; import android.webkit.WebVi
> package com.daryl.rssreader;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.*;
import com.daryl.platform.R;
public class PostViewActivity extends Activity {
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setContentView(R.layout.postview);
Bundle bundle = this.getIntent().getExtras();
String postContent = bundle.getString("content");
webView = (WebView)this.findViewById(R.id.webview);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadData(postContent, "text/html; charset=utf-8","utf-8");
}
@Override
protected void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
}
}
名为“postview.XML”的XML文件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout android:id="@+id/LinearLayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
如果我没有提供足够的信息来了解问题,请原谅,但如果需要,我可以提供更多细节
我会向你展示该应用程序现在显示的链接,但我没有足够的“声誉”
完全不知所措,代码主要来自以下方面:
但是这个人并没有给解决方案提供太多帮助
如果有人能在分析了我迄今为止所做的一切整整12个小时后帮我解决问题,我将不胜感激,因为我完全处于困境
谢谢。将您的xml文件更改为此
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
在xml文件中没有webview的空间,因为
LinearLayout
设置为math\u父项
,不幸的是,它仍然无法工作。MainActivity.java文件中提供的RSS源是否因其格式而负责?私有字符串urlString=“”;所以我试着使用教程中使用的xml链接,它很好地显示了网页,所以它一定是平台提供的rss提要。但当我用Platform()替换它时,问题又出现了。但现在我被困在这里了。因此,也许它不是网络视图,而是RSS提要本身?如果有帮助的话,该网站也在运行WordPress.org。