【问题标题】:Android: Insert immage button dynamically through codeAndroid:通过代码动态插入图片按钮
【发布时间】:2013-12-14 22:12:10
【问题描述】:

我想插入一个图像来做一个按钮。但我想通过代码插入它,而不是 .xml 文件。有人知道吗?

【问题讨论】:

    标签: java android image button imagebutton


    【解决方案1】:

    试试这个:

    ImageButton ib = new ImageButton(this);
    yourContainer.addView(ib);//here yourContainer is ParentLayout
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-15
    相关资源
    最近更新 更多