Can we create a back button like iOS in Android using the custom shape API
I would like to know if we can customise a button to show like the Apple iOS button in Androi开发者_开发知识库d?
The button that I would like to draw is
If this is possible, can someone give me the pointers to it.
Thanks.
Yes, it can be done. I'll leave the philosophy to others. The button background can be replaced with anything you choose. I saved your back icon above as iphoneback_normal.png.In photoshop I created two more states--focused and pressed
<Button
android:id="@+id/buttonNoThx3"
android:text="Back"
android:layout_height="fill_parent"
android:background="@drawable/iphonebackbutton"
/>
Create a state list iphonebackbutton drawable xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/iphoneback_pressed" />
<item android:state_focused="true"
android:drawable="@drawable/iphoneback_focused" />
<item android:drawable="@drawable/iphoneback_normal" />
</selector>
You should take a look at 9-patch png.
But using iOS-oriented approach on Android may result in poor User Experience.
精彩评论