Try android:background="@drawable/border"
without the .xml
Error trying to add border to TableRow
-
04-04-2022 - |
Question
I've found lots of examples of this and as far as I can tell I'm doing it right, but I still get an error. I've created a border.xml file and put it into a drawable folder. The folder didn't exist, so I had to create it. I have a feeling my problem is where I saved the file or possibly that I need to register it somewhere. Here you can see the file.
Here is the code for border.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffff" />
<stroke android:width="2dp" android:color="#515151"/>
<corners android:radius="3dp" />
<padding android:left="10dp" android:top="5dp"
android:right="10dp" android:bottom="5dp" />
</shape>
And here is how I'm trying to use it
<TableRow
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/border.xml"
android:padding="5dp">
The error I get is:
error: Error: No resource found that matches the given name (at 'background' with value
'@drawable/border.xml').
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow