English 中文(简体)
为什么我无法在我的申请中看到美术馆时获得适当的文本价值?
原标题:Why I am not able to getProper Text Value while Viewing Gallery in my application?

In My Application i have Implement the Simple Gallery Demo. Here i am going to set text Value according to user viewing the gallery.

The Code for GetViewmeth of Value Adaptationer category:

public View getView(int position, View convertView, ViewGroup parent) {
        ImageView i = new ImageView(this.myContext);

        i.setImageResource(this.myImageIds[position]);

        /* Image should be scaled as width/height are set. */
        i.setScaleType(ImageView.ScaleType.FIT_XY);
        /* Set the Width/Height of the ImageView. */
        i.setLayoutParams(new Gallery.LayoutParams(300, 300));

        switch(position){

        case 0:
            productName.setText("dimond540_1");

            break;
        case 1:
            productName.setText("diamond540_2");

            break;
        case 2:
            productName.setText("diamond_ink_bottle_1");

            break;
        case 3:
            productName.setText("diamond_ink_bottle_2");

            break;
        case 4:
            productName.setText("diamond_ink_bottle_3");

            break;
        case 5:
            productName.setText("micarta_1");

            break;
        case 6:
            productName.setText("micarta_2");

            break;
        case 7:
            productName.setText("vac700_1");

            break;
        case 8:
            productName.setText("vac700_2");

            break;
        }
        return i;
    }
    /** Returns the size (0.0f to 1.0f) of the views
     * depending on the  offset  to the center. */
    public float getScale(boolean focused, int offset) {
            /* Formula: 1 / (2 ^ offset) */
        return Math.max(0, 1.0f / (float)Math.pow(2, Math.abs(offset)));
    }
}

现在,虽然人们看着大概的形象,但文字价值正在改变。 但我无法得到案文。 (一) 作为第二位职位和第二位最后职位确定的价值。

我多次尝试,但每次都看一看一看一看一看,而不是第二位立场文本。

因此,我的法典有什么错误?

最佳回答

我已解决我的以下问题:

我在这一类方法中将“方法”改为“文字方法”,它发挥了巨大作用。

法典:

 public long getItemId(int position) { 

        switch(position){

        case 0:
            productName.setText("Dimond540(1)");

            break;
        case 1:
            productName.setText("Dimond540(2)");

            break;
        case 2:
            productName.setText("Diamond Ink Bottle(1)");

            break;
        case 3:
            productName.setText("Diamond Ink Bottle(2)");

            break;
        case 4:
            productName.setText("Diamond Ink Bottle(3)");

            break;
        case 5:
            productName.setText("Micarta(1)");

            break;
        case 6:
            productName.setText("Micarta(2)");

            break;
        case 7:
            productName.setText("Vac700(1)");

            break;
        case 8:
            productName.setText("Vac700(2)");

            break;
        }

        return position; 
    }
问题回答

暂无回答




相关问题
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 ...

热门标签