Android custom buttons layout

前端 未结 1 580
醉话见心
醉话见心 2021-01-03 13:57

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

Screenshot ABN Amro app

相关标签:
1条回答
  • 2021-01-03 14:42

    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

    0 讨论(0)
提交回复
热议问题