开发者

Titanium: How to to display text and images together inline in a tableview?

What I have is an XML feed of data that are basicly like facebook wall posts.

The posts themselves contain text with interspersed images and video links. Now I can parse (using regex) all the links without a problem.

MY question is what is the best way to display this to the user?

Right now I created a tableview and have each row in the table view display a post. It looks great but the images dont display, they are just raw links to an image URL.

Someone suggested to try a webview, and I placed the webview inside of the tableviewrow, but im getting mixed results as for some reason all the webviews (about 20 tableviewrows/webviews) overrun and overlap each other.

Is there开发者_如何转开发 a better strategy to display this data in an organized top down way?

Thanks!!


i would extract the content of the xml as follows:

post = this.responseXML;
feed = {
 picture: post.getElementsByTag('TagNameOfImage'),
 text: post.getElementsByTag('TagNameOfText')
};

then i would use a label for the text

var label = Ti.UI.createLabel({
  text: feed.text
});

yourRow.add(label);

and a imageView for the picture:

var iv = Ti.UI.createImageView({
  image: feed.picture
});

yourRow.add(iv);

hope i could help you.


putting webviews in a table row is a recipe for disaster.

you need to just add each element to the row view and do the appropriate layout.

take a look here if you are on iOS

corrections to "Using TableViews" from appcelerator wiki to make it work on iOS

or here if on Android

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜