`

android -> ImageButton 内部图片 padding

阅读更多

 

先给 ImageButton 设置属性 

android:scaleType="fitCenter"

 

然后 新建 drawable,   imgbtn_pd.xml 设置 background 的pading

 

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
	<padding
		android:top="15dp"
		android:bottom="15dp"
	/>
	<solid android:color="#00ffffff"/><!-- 填充的颜色 -->
</shape>

 

 

然后将 这个background 设置到 imageButton 

android:background="@drawable/imgbtn_pd"

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics