是否有任何人知道我怎麼可以皮膚的機器人按鈕,如下圖所示:如何製作「Gmail」像標題按鈕? (PIC附後)
a busy cat http://www.11sheep.com/temp/picForSO.jpg
由於提前, 利奧爾
是否有任何人知道我怎麼可以皮膚的機器人按鈕,如下圖所示:如何製作「Gmail」像標題按鈕? (PIC附後)
a busy cat http://www.11sheep.com/temp/picForSO.jpg
由於提前, 利奧爾
下面的佈局文件將產生一個5px半徑的按鈕,當然你需要輸入你自己的顏色,並將純色改成漸變以匹配你的屏幕截圖,然後在按鈕上將文本顏色更改爲白色或其他。現在沒有時間舉例說明..但祝你好運。
,最後你必須將它們作爲背景應用到您的按鈕,這樣
<Button
android:id="@+id/btnLoveThisOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Love me love u too!"
android:background="@drawable/button_background" <!-- Yes look at me -->
/>
button_background_normal.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/button_background_normal_color"/> <!-- Change this to your own colour -->
<corners android:radius="5px"/>
<stroke android:width="1dp" android:color="#20ffffff"/>
</shape>
button_background_pressed.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/button_background_pressed_color"/> <!-- Change this to your own colour -->
<corners android:radius="5px"/>
</shape>
button_background.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:state_pressed="false"
android:drawable="@drawable/button_background_normal" />
<item android:state_focused="true"
android:state_pressed="true"
android:drawable="@drawable/button_background_pressed" />
<item android:state_focused="false"
android:state_pressed="true"
android:drawable="@drawable/button_background_pressed" />
<item android:drawable="@drawable/button_background_normal" />
</selector>
我知道兩種方式,使其:
Button
TextView
或與具有雕刻矩形的圖像,用於拉伸,使用9.patch :)Button
或TextView
與透明背景和選擇繪製形狀邊界不過,我不知道他們究竟是如何做到如在畫面中。