1

タグが異なるxmlファイルがあります

<data>
   <name>xyz</name>
   <img> image with source(/res/img.jpg)</img>
   <desc>this is the description</desc>
</data>

xml で利用可能なアイテムのリストをロードし、listitem をクリックすると、名前、画像、および説明を新しい画面に表示したいと考えています。

誰か助けてください..緊急..

4

3 に答える 3

0

Use this code example to parse the XML file first.


Then with the list of the images you will need to get image from resource folder.

To get image from drawable folder using its name use this code


At last use this great tutorial to display the bunch of images in arraylist.


Links are 1. http://www.roseindia.net/tutorial/xml/dom/ParseDOMDocument.html 2. Android, reference things in R.drawable. using variables? 3. http://www.vogella.com/articles/AndroidListView/article.html

于 2012-05-07T14:09:40.007 に答える
0

XMLを読み取るように管理されている場合(教えてもらえない場合)、JSONからimageNamesを読み取ってAboutアクティビティのListViewに入力するために使用するコードは次のとおりです。

holder.logo.setImageResource(getResources().getIdentifier("about_logo_"+aboutItems.get(position).getID(),"drawable",getActivity().getPackageName()));

または、バイナリをxmlに保存して読み取るなどの別のことを意味しますか? では、XML が作成された目的ではないと言わざるを得ません。

于 2014-12-10T13:40:42.390 に答える
0

Web 上には、直面している問題 (Android の XML/List) に取り組む方法を説明するチュートリアルが多数あります。ここにいくつかあります:

そして、ウェブ上には他にもたくさんあります...

于 2012-05-07T12:43:56.123 に答える