2012-09-05 22 views

回答

1

這是不可能的,但可以很容易地創建像這樣

<?xml version="1.0" encoding="utf-8"?> 

<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> 
    <translate android:fromYDelta="0" android:toYDelta="100%" /> 
</set> 

的動畫,然後只需將動畫添加到該對象並啓動它。

0

嘛不完全是,但你可以使用筆畫與標籤對透明背景..但它會給你統一保證金圍繞項目

<item android:drawable="@drawable/blue" android:state_pressed="false"><shape> 
     <solid android:color="#00000000" /> 

     <stroke android:width="1dp" android:color="#33B5E5" /> 

    </shape></item> 

0

如果你的繪製是PNG,那麼很簡單,只需在每個1像素邊距的drawable周圍添加1個透明像素即可。但以這種方式你不能使用dp單位,只是像素被佔。

17

您可以簡單地使用InsetDrawable。這個drawable只是在你想要的任何其他drawable周圍添加一個空邊距。

+1

我怎樣才能在XML可繪製文件中做到這一點? – jrquick

+8

0

你可以在android和drawablePadding中設置內容和邊距之間的邊距:drawablePadding

相關問題