我有一個名爲playnext的XML文件。我將這個文件作爲背景添加到了我的按鈕中.XML包含兩個用於按下按鈕和釋放按鈕的圖像。我需要使用XML爲這兩個圖像添加邊框。在Android中使用xml添加邊框到按鈕
XML代碼
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false" android:drawable="@drawable/ic_remote_playnext" ></item>
<item android:state_pressed="true" android:drawable="@drawable/next_pressdown" ></item>
</selector>
請告訴我如何添加邊框嗎?是否有任何其他方式爲按鈕添加邊框?
http://stackoverflow.com/questions/3263611/border-for-an-image-view-in-android – azmuhak 2015-04-04 18:03:29
我試過了也。當我添加它將替換背景圖像。 – 2015-04-04 18:07:49