- Hands-On Android UI Development
- Jason Morris
- 384字
- 2021-07-02 23:26:07
Creating the category chooser
The category chooser is where the user will select how to file their expense claims. There'll be a fairly small number of these, and they will be represented by icons in the user interface. Fortunately for Android developers, Material specifies a huge range of standard icons, and Android Studio has features to import them as bitmap or vector graphics files. When deciding whether to use bitmap images or SVGs, it's important to consider the trade-off between these two formats, specifically in relation to Android. Especially so since in Android, multiple copies of a bitmap are often provided for different screen sizes and densities, leading to much higher-quality scaling (as most will only ever be scaled down slightly). Here's a quick table to compare them:

For the category chooser widget, you'll be importing vector graphics icons and using them as radio buttons. Let's get things started:
- In the files view to the extreme left of Android Studio, right-click on the res directory and select New, Vector Asset to open the vector import tool:

- Where it says Icon, click on the button with the Android robot.
- Use the search box at the top-left of the dialog to find the "hotel" icon, and select it.
- Click on OK to return to the import tool.
- The import tool will have changed the proposed name to ic_hotel_black_24dp; change this to ic_accommodation_black:

- In the Size boxes, select the Override checkbox and change the size to 32 dp X 32 dp.
- Click on Next and then on Finish to complete the import.
- Repeat this process, and find the room service icon. Name this one ic_food_black, and don't forget to change its size to 32 dp X 32 dp.
- Repeat this for the airport shuttle icon. This is ic_transport_black, and again, change its size to 32 dp X 32 dp.
- Repeat and find the local movies icon; name this ic_entertainment_black and remember to change its size to 32 dp X 32 dp.
- Find the "business center" icon and name it ic_business_black; again, change its size to 32 dp X 32 dp.
- Finally, find the all inclusive icon, name it ic_other_black, and override its size to 32 dp X 32 dp.
Now you have a collection of black icons that will serve as the basis for your category selector.
- 自然語言處理實戰(zhàn):預訓練模型應用及其產(chǎn)品化
- R語言數(shù)據(jù)分析從入門到精通
- EPLAN實戰(zhàn)設計
- 微信小程序開發(fā)與實戰(zhàn)(微課版)
- 精通MySQL 8(視頻教學版)
- Scala編程(第5版)
- 遠方:兩位持續(xù)創(chuàng)業(yè)者的點滴思考
- Application Development with Swift
- 進入IT企業(yè)必讀的324個Java面試題
- Oracle Database XE 11gR2 Jump Start Guide
- Spring Boot從入門到實戰(zhàn)
- KnockoutJS Blueprints
- Mastering Linux Kernel Development
- Jenkins 2.x Continuous Integration Cookbook(Third Edition)
- CentOS High Performance