1 . 最近在项目中自定义toggleButton 发现背景图放入后 ,比美工给我的原图要大很大
2. 为什么?
3.比较ToggleButton 和TextView源码 发现,
toggleButton 设置了minWidth 和minHeigh ,导致我的背景小图被拉伸。
4.解决这种问题:
重新设置maxHeight;maxwidth
<ToggleButton
android:id="@+id/toggle_passwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/toggle"
android:textOn=""
android:textOff=""
android:minWidth="40dp"
android:minHeight="24dp"
/>
版权声明:本文为博主原创文章,未经博主允许不得转载。(转载请注明出自 AllenCoder)