Android custom buttons layout

2019-02-11 04:36发布

How can I create buttons like the "ABN Amro Bankieren" application for the Netherlands with onclick handlers?

Screenshot ABN Amro app

1条回答
ら.Afraid
2楼-- · 2019-02-11 05:12

You have to make 2 pressed and normal (it may be 4 for focused and disabled) xml layout for each 3 top, center and bottom buttons. This is example xml for the center button for normal state is

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#F7FCF6"/>
    <stroke android:width="2sp" android:color="#9FA89F"/>      
</shape>

to make it rounded corner you may use corner tag for top button

<corners android:bottomLeftRadius="0.1sp"
android:bottomRightRadius="0.1sp" android:topLeftRadius="7sp"
android:topRightRadius="7sp" />

this may cause problem in xml layout editer but will be fine on emulator or real device

查看更多
登录 后发表回答