I found this code while searching for a button with good graphics,
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:radius="100dp"
/>
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="#7995A8"
android:startColor="#E8E8E8"
android:endColor="#000000"
android:type="linear"
/>
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"
/>
<size
android:width="270dp"
android:height="60dp"
/>
<stroke
android:width="3dp"
android:color="#878787"
/>
</shape>
However, when I copy and paste it into an XML file in Android Studio, it shows and error that says:
"element shape does not have required attribute android:layout_height"
and another error:
"element shape does not have required attribute android:layout_width"
I tried setting the android:layout_width="" and android:layout_heigth""
and android:layout_width"wrap_content", android:layout_heigth="wrap_content", the error is gone, but I can't set any button to have this as it's background ... so I can't use this XML this way.
What should I set them to?