Benutzer:MovGP0/Xamarin/Shaped Buttons
aus Wikipedia, der freien Enzyklopädie
< Benutzer:MovGP0 | Xamarin
MovGP0 | Über mich | Hilfen | Artikel | Weblinks | Literatur | Zitate | Notizen | Programmierung | MSCert | Physik |
(Irrgegular) Shaped Buttons in Xamarin
AndroidProvide button shapes
<?xml version="1.0" encoding="utf-8"?>
<!-- see android.graphics.drawable.shapes.* for possible shapes -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:angle="270" android:endColor="#4aae87" android:startColor="#FF4AAE87" />
<corners android:radius="0dp" />
<stroke android:width="2dp" android:color="#2a7e5d" />
</shape>
Use a selector to apply proper style based on button state in <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/mybutton_default" />
<item android:drawable="@drawable/mybutton_focused" android:state_focused="true" />
<item android:drawable="@drawable/mybutton_pressed" android:state_pressed="true" />
</selector>
Apply style to button: <Button
android:id="@+id/mybutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_text"
android:onClick="onButtonClicked"
android:background="@drawable/mybutton" />
Add an ripple effect.[1] iOSrender UIControl using custom renderer react to touch events for animation react to UIButtonState WPF/UWPUse a control template DataBinding OptionsQuellen
|