解析网页时创建TextViews和ImageViews

时间:2014-01-21 16:07:03

标签: android layout

这个问题很难解释。
我正在使用JSoup解析一个网页,该页面是一篇博文。它有时会改变。
例如:

Look at my new car! 
*image here*
How do you Like it?

Yesterday I was doing nothing but watching TV
Such a rainy day.

我想要的是动态创建TextView,文本之前图像,然后ImageView带图像和TextView带文字图像(或更复杂的内容)
我试过这个

this.setContentView(R.layout.post_test);

final ViewGroup vg = (ViewGroup) findViewById(R.layout.post_test);

iv = new ImageView(this);
RelativeLayout rl = new RelativeLayout(this);
rl.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
iv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
rl.addView(iv);
vg.addView(View.inflate(this, rl, null));

但没有运气。
我不想使用WebView,因为它外观不好而且没有使用KitKat 那就是我的意思: Pic1 Pic2

0 个答案:

没有答案
相关问题