My application supports a minimum of API 8 (platform version 2.2). But borderless buttons require API 11. So when I try to make a button like:
<button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="displayText"
style="?android:attr/borderlessButtonStyle" ></button>
Reference: Borderless button subsection in this developer guide
I get an error ?android:attr/borderlessButtonStyle requires API level 11 (current min is 8)
I have the support library android-support-v4.jar
in the libs
folder of my project. So I removed the android namespace and changed it to style="?attr/borderlessButtonStyle"
(suggested in some comment here) and now I get this error:
No resource found that matches the given name (at 'style' with value '?attr/borderlessButtonStyle').
I could not either find a "BorderlessButtonStyle" mention, or even that of a "button" in this, or this document?
What should I do? Which support library should I use?
EDIT 1 On suggestion by @NaveenTamatar in the comment:
res/drawable/selector_transparent_button.xml
Problem 1:-
Attribute "exitFadeDuration" is only used in API level 11 and higher (current min is 8)
So I tried this with a slight change:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:color="#227EC9" ></item>
<item android:state_selected="true" android:color="#227EC9"></item>
<item android:state_enabled="false" android:color="#ADADAD"></item>
<item android:color="#2E2E2E"/>
</selector>
in a file named selector_transparent_button.xml
in res/drawable/
(I created drawable directory myself, those like drawable-hdpi, drawable-ldpi were there but no drawable, a quick web search revealed I could create it, if this matters at all).
Problem 2:-
error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/button_pressed').
error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/button_focused').
error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/button_default').