目的: 只抚摸顶部和底部。
我试过的:
下面是我的 XML 的副本。我已尝试遵循This Stack Overflow Answer中的解决方案。但我的问题是,不允许我根据解决方案选择将左右切断 1dp 的选项。
有任何想法吗?
代码:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape >
<gradient
android:startColor="@color/secondaryButtonStartColorSelected"
android:endColor="@color/secondaryButtonEndColorSelected"
android:angle="270" />
<stroke
android:width="@dimen/secondary_button_border_size"
android:color="@color/secondaryButtonBorderColorSelected" />
</shape>
</item>
<item android:state_focused="true" >
<shape>
<gradient
android:startColor="@color/secondaryButtonStartColorSelected"
android:endColor="@color/secondaryButtonEndColorSelected"
android:angle="270" />
<stroke
android:width="@dimen/secondary_button_border_size"
android:color="@color/secondaryButtonBorderColorSelected"/>
</shape>
</item>
</selector>