Code example for ImageSwitcher

Methods: setFactory, setId, setImageResource

0
        super.onCreate(savedInstanceState);
 
        //´´½¨Ò»¸öÏßÐÔ²¼¾ÖLinearLayout 
        LinearLayout main_view = new LinearLayout(this);
        //´´½¨ImageSwitcher¶ÔÏó 
        m_Switcher = new ImageSwitcher(this);
        //ÔÚÏßÐÔ²¼¾ÖÖÐÌí¼ÓImageSwitcherÊÓͼ 
        main_view.addView(m_Switcher);
        //ÉèÖÃImageSwitcher¶ÔÏóµÄID 
        m_Switcher.setId(SWITCHER_ID);
        //ÉèÖÃImageSwitcher¶ÔÏóµÄÊý¾ÝÔ´ 
        m_Switcher.setFactory(this);
        m_Switcher.setImageResource(imagelist[index]);
 
        //ÉèÖÃÏÔʾÉÏÃæ´´½¨µÄÏßÐÔ²¼¾Ö 
        setContentView(main_view);
 
        //´´½¨¡°ÏÂÒ»ÕÅ¡±°´Å¥ 
        Button next = new Button(this);
        next.setId(BUTTON_DWON_ID);
        next.setText("ÏÂÒ»ÕÅ");