English 中文(简体)
a. 将一套图像输入滚动图
原标题:Load a set of images into a scrollview

奥凯,因此,我有一阵图象。 我想把它们装入横向发展观点。 这是我走下去的路,但是,在 Sc意见应当到的地方,没有显示:

public void run() {
    JSONArray photosArray;
    caption = new WebView(thisContext);
    imageScroller = new HorizontalScrollView(thisContext);
    imagesHolder = new LinearLayout(thisContext);
    imagesHolder.setOrientation(LinearLayout.HORIZONTAL);
    try {
        photosArray = new JSONArray(postData.getString("photos"));
        for(int i = 0; i < photosArray.length(); i++) {
            WebView iV = new WebView(thisContext);
            JSONObject thisPhoto = photosArray.getJSONObject(i);
            JSONArray sizesArray = new JSONArray(thisPhoto.getString("alt_sizes"));
            JSONObject largest = sizesArray.getJSONObject(0);
            iV.loadData("<img src=""+largest.getString("url")+"" />", "text/html", null);
            imagesHolder.addView(iV);
        }
        imageScroller.addView(imagesHolder);
        myPostHolder.addView(imageScroller);
        caption.loadData(postData.getString("caption"),"text/html",null);
        myPostHolder.addView(caption);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

请注意,这是在可操作类别中进行的。 非常感谢

最佳回答

单一阅读模式有两种规则。

  1. Do not block the UI thread
  2. Do not access the Android UI toolkit from outside the UI thread

因此,我不认为你可以在主线之外向一个观点小组提出看法。 见。 更完整的解释。

此外,你需要确保你实际制定<条码>连续概览<>代码”,并且可能需要在<条码>查询组上打<条码>,以便进行重整。

而且,你或许应当使用<代码>。 GridView.can t see 所以, You d's d use a webview for this.

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签