Android Borderless Button: No resource found that matches the specified name (in 'drawable' with value '@ drawable / button_pressed'

My application supports at least 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: Subdivision of Borderless Button in This Developer Guide

Am I getting an error ? android: attr / borderlessButtonStyle requires API level 11 (current minimum 8)

I have a support library in my project folder . So I removed the android namespace and changed it to (suggested in some comment here ) and now I am getting this error: Resource not found that matches the specified name (in 'style' with value '? Attr / borderlessButtonStyle'). android-support-v4.jar

libs

style="?attr/borderlessButtonStyle"

I couldn't find any mention of BorderlessButtonStyle, or even the name "button" in this , or this document?

What should I do? Which support library should I use?


EDIT 1 As suggested by @NaveenTamatar in the comment:

Res / pull / selector_transparent_button.xml  

Problem 1: -

The "exitFadeDuration" attribute is only used in API level 11 and above (current min is 8)

So, I tried this with small changes:

<?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 a drawing directory myself, such as drawable-hdpi, drawable-ldpi were there but weren't available, a quick web search showed that I could create it if it mattered at all).

Problem 2: -

Error: Error: No resource found that matches the specified name (in 'drawable' with value '@ drawable / button_pressed').

Error: Error: No resource was found that matches the specified name (in 'drawable' with value '@ drawable / button_focused').

Error: Error: No resource was found that matches the specified name (in 'drawable' with value '@ drawable / button_default').

+3


source to share





All Articles