我想畫一個完美的圓形按鈕。 我嘗試使用下面的代碼:如何繪製完美的圓形按鈕?
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<stroke
android:width="3dip"
android:color="#065a32" />
<corners android:radius="10dip"/>
<solid android:color="#eaebec" />
</shape>
但我只能畫一個橢圓形,即使我改變參數:
<stroke
android:width="3dip"/>
<corners android:radius="10dip"/>
我的截圖:
我已經嘗試過本網站的不同鏈接,但沒有一個能滿足我的需求。
編輯:
我的getView()的代碼是:
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (convertView == null) {
LayoutInflater vi = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.calendar_item, null);
}
view.setBackgroundResource(R.drawable.calendar_cell_clicked);
}
可以在Photoshop畫一個圓的圖像,並設置爲背景button.Can根據屏幕大小改變圖像的分辨率。 –