开发者

I am not getting addView() method for object of view i.e v in my code below?

I want to add button dynamically in开发者_JAVA百科 this view i.e. v

public class MyviewActivity extends Activity {
    /** Called when the activity is first created. */

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        LayoutInflater inflater=this.getLayoutInflater();
        View v=inflater.inflate(R.layout.main, null, true);//view
    }
}


The View class doesn't have an addView method. You need to use one of the base classes that extends ViewGroup such as LinearLayout.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜