0
A
回答
3
試試下面的代碼: -
<Button
android:id="@+id/action"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:layout_margin="5dp"
android:background="@drawable/btn_click"
android:gravity="center"
android:textColor="@color/white"
android:textSize="12sp" />
btn_click.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/button_hover" android:state_pressed="true"/>
<item android:drawable="@drawable/button"/>
</selector>
btn_hover.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="1dp"
android:color="#000000" />
<gradient
android:angle="270"
android:centerColor="#1a000000"
android:endColor="#33000000"
android:startColor="@android:color/transparent" >
</gradient>
<corners android:radius="5dp" />
</shape>
btn.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:color="#000000"
android:width="1dp"
/>
<gradient
android:angle="270"
android:centerColor="@android:color/transparent"
android:endColor="@android:color/transparent"
android:startColor="@android:color/transparent" >
</gradient>
<corners android:radius="5dp" />
</shape>
btn_click.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_hover" android:state_pressed="true"/>
<item android:drawable="@drawable/btn"/>
</selector>
0
您可以通過編程的方式創建這樣下面的圖片。 Ref Here:
相關問題
- 1. 使用Android中的圖像製作RadioGroup單選按鈕...如何?
- 2. iOS - 如何更改按鈕圖像,而無需調整大小和重新定位按鈕視圖
- 3. 如何使用按鈕更改圖像顏色,而無需使用360個不同的css圖紙?
- 4. Play.gif圖像,而無需使用的WebView
- 5. 提交按鈕,而使用型圖像
- 6. 我需要使用Draw9Patch圖像按鈕?
- 7. 如何用一個按鈕控制兩個按鈕的圖像?
- 8. 如何自動顯示數據而無需使用按鈕?
- 9. 如何使用SignalR定期保存頁面,而無需點擊任何按鈕?
- 10. Android:通過Id查找視圖而無需點擊UI按鈕
- 11. 插入圖像,而無需使用imageTK
- 12. Android圖像按鈕
- 13. Android圖像按鈕
- 14. android圖像按鈕
- 15. 用按鈕繪製圖像
- 16. 如何自動捕捉並保存圖像,而無需在Android中按捕捉按鈕?
- 17. 帶圖像的自定義android按鈕
- 18. 像按鈕定製
- 19. Android:使用圖像而不是文本在按鈕上
- 20. 如何使用一個圖像,而不是單選按鈕
- 21. 使用圖像製作引導按鈕
- 22. Android:通過按鈕繪製圖像
- 23. 如何僅灰顯按鈕圖像而不是整個按鈕
- 24. 如何使用圖像按鈕
- 25. 如何上傳圖像到服務器,而不使用上傳按鈕在android
- 26. 如何使用CSS彈出按鈕圖像上的按鈕
- 27. 如何製作圖像按鈕
- 28. 如何使用自定義按鈕,而不是jQuery UI按鈕?
- 29. 如何上傳圖像,而無需使用一滴
- 30. 如何動態重放的圖像按鈕圖像源的android
檢查了這一點http://mrbool.com/how-to-customize-different-buttons-in-android/27747 –
如果你看一下使用第三方庫檢查:HTTPS ://github.com/Bearded-Hen/Android-Bootstrap –