【问题标题】:Android - Removing the gray border of an imagebutton programmaticallyAndroid - 以编程方式删除图像按钮的灰色边框
【发布时间】:2013-08-04 23:37:23
【问题描述】:

我有一个应用程序可以生成 imageButtons 并将它们放在 TableRow 中。

但是,imageButton 在可绘制文件夹中的图像上没有的侧面有一个灰色边框。

如何以编程方式移除这些边框?到目前为止,我看到的解决方案在布局中使用了 xml 属性,但我无法使用该解决方案,因为我以编程方式生成了我的 imageButtons。

有什么想法吗?

【问题讨论】:

    标签: android imagebutton


    【解决方案1】:

    找到了答案。

    imageButton.setBackground(null);

    【讨论】:

    • 对不起!我没有看到这个答案!
    • 没关系,没问题。
    【解决方案2】:

    你可以使用

    ImageButton btn = (ImageButton)findViewById(R.id.imagebutton);
    btn.setBackground(null);
    

    祝你好运

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-23
      • 2021-06-04
      • 1970-01-01
      • 2015-06-28
      • 2012-09-27
      • 1970-01-01
      • 2015-04-07
      • 1970-01-01
      相关资源
      最近更新 更多