我在网站上看到了这个按钮,我想在xml中重新创建它。但是,我无法确定正确的尺寸。下面是我到目前为止的代码,但它与形状不完全匹配。希望有人可以帮忙!
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="@color/white"></solid>
<corners
android:radius="600dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
<stroke
android:width="3px" android:color="@color/salmon_main"/>
</shape>
答案 0 :(得分:10)
This question already asked click there to check
function titleCase(str) {
var wordArr = str.split(" ");
var newArr = wordArr.map(function(word){
word = word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
});
return newArr;
}
答案 1 :(得分:1)
试试这个,
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="17dp" />
<gradient
android:angle="90" />
<solid android:color="#FFFFFF"/>
<stroke
android:width="2dp"
android:color="#FFFFFF" />
</shape>
答案 2 :(得分:0)
在drawable文件夹中创建XML文件:
oval_background.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<gradient
android:startColor="#6586F0"
android:centerColor="#D6D6D6"
android:endColor="#4B6CD6"
android:angle="90"/>
</shape>
答案 3 :(得分:0)
试试这个,这也是有涟漪效应的
<?xml version="1.0" encoding="utf-8"?>
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/press">
<item>
<shape
android:shape="rectangle">
<solid android:color="#FF9800" />
<corners android:radius="30dp" />
<stroke android:width="1dip" android:color="#FF9800" />
<gradient android:angle="-90" android:startColor="#FF9800" android:endColor="#FF9800" />
</shape>
</item>
<item android:state_focused="true">
<shape android:shape="rectangle" >
<corners android:radius="30dp" />
<stroke android:width="1dip" android:color="#FF9800" />
<solid android:color="#FF9800"/>
</shape>
</item>
<item >
<shape android:shape="rectangle" >
<corners android:radius="30dp" />
<stroke android:width="1dip" android:color="#FF9800" />
<gradient android:angle="-90" android:startColor="#FF9800" android:endColor="#FF9800" />
</shape>
</item>
</ripple>