简体   繁体   中英

Android custom buttons layout

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

Screenshot ABN Amro app

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM