Android,删除自定义按钮边框

标签 android background imagebutton

我将此选择器代码用于我的自定义按钮 (simple.xml)

  <?xml version="1.0" encoding="utf-8"?>

  <selector xmlns:android="http://schemas.android.com/apk/res/android">
      <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/focused" />
      <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/focusedpressed" />
      <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/pressed" />
      <item android:drawable="@drawable/defaultbutton" />
  </selector>

但是在我的 ImageButton 上我不知道如何删除边框。我只想显示我的图像而不显示按钮周围的边框。

谢谢 alt text

最佳答案

我替换

    <ImageButton android:id="@+id/imagebutton"
  android:src="@drawable/simple"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  />

与:

    <ImageButton android:id="@+id/imagebutton"
  android:background="@drawable/simple"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  />

工作

关于Android,删除自定义按钮边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3803162/

相关文章:

html - 全屏背景html

android - GridView 内的 ImageButton 不可点击

android - 在没有动画的情况下旋转 ImageButton

android - 切换标签页时如何防止我的应用程序调用 onCreate()?

java - 处理中的 keyPressed 问题

android - 使用android代码在GSM Mobile上获取手机号码

c# - 如何更改 TabControl.Header 的背景颜色

Android TableLayout 拉伸(stretch)单元格内容

android - 可绘制 2 种纯色

android - 是否有任何 API 可以同时获取后置和前置摄像头 View ?