0

I cannot figure out why my Android Studio is giving me this error when I am trying to make my FrameLayout have rounded edges. This is the exact error it gives me "Error:(162) No resource identifier found for attribute 'corners' in package 'android'", I have rebuilt my project to see if that was the problem but fortunately it wasn't, can someone explain. I am running version 0.8 Android Studio and my Lowest SDK Version is API 13.

The XML layout file that gives me the error

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#ffffff"/>
    <corners android:radius="10dip"/>
    <stroke android:color="#000000" android:width="1dp"/>
</shape>

Update I no longer get the 'corners' attribute error. I recreated the file by deleting it and creating a new XML file, but when I try to apply this layout to my FrameLayout I get this error "Error:(126, 15) error: method setBackground in class View cannot be applied to given types;

required: Drawable

found: int

reason: actual argument int cannot be converted to Drawable by method invocation conversion"

Cup of Java
  • 1,769
  • 2
  • 21
  • 34

2 Answers2

1

that's not a layout; it's a shape drawable. ensure it is located in "res/drawable" not "res/layout".

j__m
  • 9,392
  • 1
  • 32
  • 56
  • It is in drawable, and I'm applying it to a FrameLayout through myLayout.setBackground(R.drawable.roundcorners); – Cup of Java Jul 05 '14 at 02:45
  • actually, looking at the error message, it's complaining about a `corners` _attribute_ but your code sample only has a `` _element_. assuming you didn't misquote the error or the xml, i can only suggest cleaning/rebuilding your project. – j__m Jul 05 '14 at 02:51
  • setBackgroundResource(R.drawable.myshape); – j__m Jul 05 '14 at 02:52
  • Thank you so much for that comment. Everything is fixed – Cup of Java Jul 05 '14 at 02:54
0

Just a guess: maybe because you are specifying shape as rectangle there is a problem with corners?

Check this answer: How to make layout with rounded corners..?

Community
  • 1
  • 1
marimaf
  • 5,382
  • 3
  • 50
  • 68