I want to use custom toggle buttons. Currently I use the following xml file to define a "custom" background:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/switchon" android:state_checked="true" />
<item android:drawable="@drawable/switchoff" android:state_checked="false"/>
</selector>
with
and
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FF0000" />
<corners android:bottomRightRadius="35dp"
android:bottomLeftRadius="35dp"
android:topRightRadius="35dp"
android:topLeftRadius="35dp"/>
</shape>
as background.
When I include the button in the layout with the following code, it produces a red/green toggle button.
<ToggleButton
android:id="@+id/ToggleButton1"
android:layout_height="50dp"
android:layout_marginRight="30dp"
android:background="@drawable/toggle_button"
android:text=""
android:textOff=""
android:textOn=""
android:layout_marginStart="99dp"
android:layout_marginTop="84dp"
android:layout_width="50dp"
android:layout_below="@+id/section_label"
android:layout_toEndOf="@+id/section_label"
style="@android:style/Widget.Button.Toggle"
android:checked="true" />
Now i want this button to have a certain elevation. Adding android:elevation="2dp" does not produce any effect.
Can anyone tell me how to do that? I was not able to find a solution to that.