单击Android按钮时,Android按钮周围出现未知的黑色边框

单击Android按钮时,Android按钮周围出现未知的黑色边框,android,android-button,android-styles,Android,Android Button,Android Styles,在为我在Android应用程序中使用的一些按钮指定自定义样式后,我注意到当单击按钮时,按钮周围会出现一个神秘的黑色边框。我试着以我的风格跨越边界,但似乎没有任何效果。我怎样才能摆脱它 orange_button.xml 活动按钮测试.xml 无压力 按下 编辑:尝试将其添加到styles.xml中: <resources> <style name="AppTheme" parent="android:Theme.Holo.Light"> <

在为我在Android应用程序中使用的一些按钮指定自定义样式后,我注意到当单击按钮时,按钮周围会出现一个神秘的黑色边框。我试着以我的风格跨越边界,但似乎没有任何效果。我怎样才能摆脱它

orange_button.xml


活动按钮测试.xml

无压力

按下

编辑:尝试将其添加到styles.xml中:

<resources>
  <style name="AppTheme" parent="android:Theme.Holo.Light">
    <item name="android:buttonStyle">android:borderlessButtonStyle</item>
  </style>
</resources>

android:无边框按钮样式

既然所有状态都相同,为什么不将背景更改为
@color/OrangePastel
,而不是创建一个具有相同可绘制状态的选择器color@tyczj我在帖子中说这只是为了测试。按钮最后会有不同的颜色。它解决了问题,但我不能在ImageButton中放入文本。仍然不起作用。Android Studio找不到Android:borderlessButtonStyle,即使我在@Android:style/Widget.Holo.Light.button.borderless中指定了适当的无边框按钮样式,边框也会不断出现。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="ButtonTestActivity">

    <Button
        android:id="@+id/testButton2"
        android:text="@string/hello_world"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/orange_button"/>


</LinearLayout>
<resources>
  <style name="AppTheme" parent="android:Theme.Holo.Light">
    <item name="android:buttonStyle">android:borderlessButtonStyle</item>
  </style>
</resources>